Reputation: 55
actually i have problem for use str_replace , i put my example :
<?php
$chars_1=array('\',"/","&","¬","~","-","_");
$chars_2=array("","","","","","","");
$result=str_replace($chars_1,$chars_2,$text);
?>
The problem it´s when in the array put the character \ , for the rest i haven´t problem but if i put or use \ for change by other character i have problem , how i can replace \ and use in array for replace for nothing in this case , if use this replace with \ the mini script give me error if no use in replace \ all ok
Thank´s !
Upvotes: 1
Views: 55
Reputation: 219920
You have to escape the slash, by using a double slash:
$chars_1 = array('\\',"/","&","¬","~","-","_");
Upvotes: 1