// fix quotes
$text = preg_replace_callback('~\[quote=("?)([^"]+?)\\1(?:\s+post_id=(\d+)[^\]]*)?\]~', function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[2]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[2]);
$postID = isset($matches[3]) ? $matches[3] : null;
if ($postID) {
// fix quotes
$text = preg_replace_callback('~\[quote="([^"]+?)"\]~', function ($matches) {
- $username = str_replace(array("\\", "'"), array("\\\\", "\'"), $matches[1]);
+ $username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
return "[quote='".$username."']";
}, $text);