ASP Replace in PHP?
Hi I want to do a simple replace using str_replace, lik开发者_JAVA百科e Classic ASP.
$strName="Blush / Black";
$strName=$strName(str_replace("/","&"));
It should read, when echo:
Blush & Black. I get an Fatal error: Call to undefined function
$strName="Blush / Black";
$strName=str_replace("/","&", $strName);
$strName=$strName(str_replace("/","&"));
^---- error
you're using a "variable function". In this case, telling PHP to execute a function called Bush / Black
, which is not a valid function name, and also doesn't exist.
What you want is:
$strName = str_replace('/', '&', 'Blush / Black');
精彩评论