简体   繁体   English

PHP str_replace与array()不起作用? (有例子)

[英]PHP str_replace with array() not working ? (have example)

[code] [码]

echo str_replace(array('(', ')'), '', "(test) i'm test"); exit;

[run] [跑]

(test) i'm test

I want to remove brackets from this text, but it not working? 我想从此文本中删除方括号,但不起作用?

// Note: Code will remove brackets from the following string: //注意:代码将从以下字符串中删除方括号:

     $string= "(test) i'm test";
     echo str_replace(array( '(', ')' ), '', $string);

// Output:- test i'm test //输出:-测试我正在测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM