note 45469 deleted from function.stripslashes by aidan

From: Date: Thu, 09 Sep 2004 02:05:44 +0000
Subject: note 45469 deleted from function.stripslashes by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76262@lists.php.net to get a copy of this message
Note Submitter: me at _N0SP4M_callum-macdonald dot com ---- I wanted to automatically strip all the slashes from variables that have been submitted by post, so I wrote the following function which may be useful. <?php function strip($array) { foreach ($array as $key => $val) { if (is_array($val)) { $array[$key] = strip($val); } else { $array[$key] = stripslashes($val); } } return ($array); } ?> At the top of the script, I then call: $post = strip($_POST); Enjoy...

« previous php.notes (#76262) next »