top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How is it possible to remove escape characters from a string in PHP ?

+4 votes
591 views
How is it possible to remove escape characters from a string in PHP ?
posted Feb 1, 2016 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Use stripcslashes, check the man page of it at http://php.net/stripcslashes

Example

$stripped = 'this is a string with three\\\ slashes';
$stripped = stripslahses($stripped);

output:

'this is a string with three\ slashes'
answer Feb 1, 2016 by Salil Agrawal
Similar Questions
0 votes

I am having an string which was have few ' (single quote) and few " (double quotes) and was not able to insert into the mysql database. I have replaced them with \' and \" and everything is fine.
Though this are fine now but don't understand the working and I could have missed few corner cases also. Please suggest the working and also if there is some better way to achieve this.

...