php - str_replace - Only variables can be passed by reference -


this question has answer here:

what causing error?

fatal error: variables can passed reference in /var/www/application /lib/testing/imagemaker/imagemaker.php on line 24

$x=str_replace ($s1,'',$s2); $y=str_replace ($s1,'',$s2, 1 ); //line 24 

as described here: php manual: str_replace

count

if passed, set number of replacements performed.

you cannot pass literals , rather pass reference:

$x=str_replace ($s1,'',$s2); $y=str_replace ($s1,'',$s2, $count); echo $count; 

Comments