note 39308 deleted from function.stripslashes by aidan
| From: | aidan@php.net | Date: | Sun, 29 Aug 2004 10:22:29 +0000 |
| Subject: | note 39308 deleted from function.stripslashes by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75529@lists.php.net to get a copy of this message | ||
Note Submitter: mike-php at emerge2 dot com
----
Some values in $_POST or $_GET are arrays and not strings. In fact, some of the values can even be
multi-dimensional arrays! Use this to strip an array, even if it is multi-dimensional:
function stripslashes_array( $given ) {
return is_array( $given ) ? array_map( 'stripslashes_array', $given ) : stripslashes(
$given );
}
This function returns a string if passed a string, an array if passed an array, so it's always
safe to call. However, you still want to check get_magic_quotes_gpc() to see if you even need to
strip the slashes.
Mmmmmmmmmm...php.