Page 1 of 1
PHP - escaping special characters... help!!
Posted: Wed Oct 22, 2008 8:46 pm
by x135
Hi all,
I am in need of the php script to escape special characters out of a text file that has tab seperated data.
Any ideas?
Any help would be most appreciated
Re: PHP - escaping special characters... help!!
Posted: Thu Oct 23, 2008 5:10 am
by maneetpuri
There is no explicit function for escaping special characters in PHP, but you can use addslashes() to introduce slashes in front of every special character, which would not lead a special character treated as a special character. The antonym of addslashes is stripslashes which removes the slashed pre fixed before every special character in a staring.
And you want to totally remove special characters then you will have to write a small piece of code that will remove all the defined special characters in an array from the string being processed.
Hope this helps!
Cheers,