开发者

ASP Replace in PHP?

开发者 https://www.devze.com 2023-04-12 00:54 出处:网络
Hi I want to do a simple replace using str_replace, lik开发者_JAVA百科e Classic ASP. $strName=\"Blush / Black\";

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');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号