note 93805 added to function.array-walk-recursive
| From: | markfiend at gmail dot com | Date: | Wed, 30 Sep 2009 14:49:26 +0000 |
| Subject: | note 93805 added to function.array-walk-recursive | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161170@lists.php.net to get a copy of this message | ||
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');
?>
----
Server IP: 87.124.86.45
Probable Submitter: 78.105.118.2 (proxied: 78.105.118.2)
----
Manual Page -- http://www.php.net/manual/en/function.array-walk-recursive.php
Edit -- https://master.php.net/note/edit/93805
Del: integrated -- https://master.php.net/note/delete/93805/integrated
Del: useless -- https://master.php.net/note/delete/93805/useless
Del: bad code -- https://master.php.net/note/delete/93805/bad+code
Del: spam -- https://master.php.net/note/delete/93805/spam
Del: non-english -- https://master.php.net/note/delete/93805/non-english
Del: in docs -- https://master.php.net/note/delete/93805/in+docs
Del: other reasons-- https://master.php.net/note/delete/93805
Reject -- https://master.php.net/note/reject/93805
Search -- https://master.php.net/manage/user-notes.php