You need to put the pattern in parentheses /([A-Z])/
, like this:
preg_replace("/([A-Z])/", "<span class=\"initial\">$1</span>", $str)
You need to put the pattern in parentheses /([A-Z])/
, like this:
preg_replace("/([A-Z])/", "<span class=\"initial\">$1</span>", $str)