1

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 !

1 Answer 1

1

You have to escape the slash, by using a double slash:

$chars_1 = array('\\',"/","&","¬","~","-","_");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.