开发者

Strtr requires an array as the second argument?

I am calling code like

strtr($somevars['thisvar'], "abc")

Where $somevars['thisvar'] contains a string.

And it's giv开发者_JAVA技巧ing me

Warning:  strtr() [function.strtr]: The second argument is not an array

Why?


Warning: strtr() [function.strtr]: The second argument is not an array

strtr != strstr

see: http://docs.php.net/strtr


You have two possibilties for strtr:

string strtr ( string $str , string $from , string $to );

string strtr ( string $str , array $replace_pairs );

So even you add a third parameters and you can use a string, or you set an array and don't add a third parameter :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜