note 38782 deleted from function.get-magic-quotes-gpc by didou
| From: | didou@php.net | Date: | Wed, 07 Jan 2004 10:43:45 +0000 |
| Subject: | note 38782 deleted from function.get-magic-quotes-gpc by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63057@lists.php.net to get a copy of this message | ||
Note Submitter: eric_taylor atsymbol morgan-cain dot com
----
Argh! Never try and hand-enter working code... I forgot the return statements on my last code
snippet. This one really works:
function maybeAddSlashes( $element ) {
// If element is an array, recurse on that subarray
if ( is_array( $element ) ) {
return array_map( "maybeAddSlashes", $element );
} else {
// If element has an unslashed single-quote, addslashes
if ( ereg( "[^\]'", $element ) ) {
$element = addslashes( $element );
}
return $element;
}
}