note 93806 deleted from function.array-walk-recursive by danbrown
| From: | danbrown@php.net | Date: | Wed, 30 Sep 2009 15:34:49 +0000 |
| Subject: | note 93806 deleted from function.array-walk-recursive by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161173@lists.php.net to get a copy of this message | ||
Note Submitter: markfiend at gmail dot com
----
array_walk_recursive is handy for sanitizing the $_POST and $_GET superglobals to mitigate the
threat of database injection attacks:
<?php
function sanitize(&$value, $key) {
# The definition of this function is left as an exercise for the class
}
$post = $_POST;
$get = $GET;
array_walk_recursive($post, 'sanitize');
array_walk_recursive($get, 'sanitize');
?>