note 82119 deleted from function.addslashes by felipe
| From: | felipe@php.net | Date: | Sat, 29 Mar 2008 15:35:50 +0000 |
| Subject: | note 82119 deleted from function.addslashes by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137708@lists.php.net to get a copy of this message | ||
Note Submitter: Aditya P Bhatt (adityabhai at gmail dot com)
----
i think we all know that addslashes() and stripslashes() just dont work if you have an array, here
is a function you can use for either array's or for typical variables.
<?php
function adslashes($array) {
if(is_array($array)){
foreach($array as $key => $val){
if(is_array($key) {
return adslashes($key);
} else {
$return[$key] = stripslashes($val); // recurse
}
}
return($return);
} else{
return(addslashes($array)); // return slash'ed value
}
}
?>