note 52469 deleted from function.strip-tags by nlopess
| From: | nlopess@php.net | Date: | Thu, 30 Jun 2005 09:13:18 +0000 |
| Subject: | note 52469 deleted from function.strip-tags by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91189@lists.php.net to get a copy of this message | ||
Note Submitter: info {at at } programare dot dot dot org
----
A simple function to strip given characters:
function strip_chars($string,$chars) {
preg_match_all("(.)",$chars,$tmp_clean);
return(str_replace($tmp_clean[0],
array_fill(0,count($tmp_clean),""),$string));
}
Then use it:
echo strip_chars("Any text you 'want';"," ';");
=> 'Anytextyouwant'