Posts Tagged ‘All’
PHP: String Replace All
March 14, 2013
Leave a comment
In PHP str_replace() is used to replace the strings, It also support to replace multiple string.
The below example code is used to replace the multiple string/char in a string.
In the code $delimiters array() is used to set the multiple delimiters.
$str_in = '[wel.co/me]'; $delimiters = array('[', ']', '.', '/'); $str_out = str_replace($delimiters, "", $str_in); print($str_out); // INPUT [wel.co/me] // OUTPUT welcome
Referance:
http://php.net/manual/en/function.str-replace.php