note 39308 added to function.stripslashes
| From: | mike-php at emerge2 dot com | Date: | Fri, 23 Jan 2004 22:00:01 +0000 |
| Subject: | note 39308 added to function.stripslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64086@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.stripslashes.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39308
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39308&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39308&report=yes
Search -- http://master.php.net/manage/user-notes.php