note 45469 added to function.stripslashes

From: Date: Wed, 08 Sep 2004 13:11:26 +0000
Subject: note 45469 added to function.stripslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-76231@lists.php.net to get a copy of this message
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... ---- Manual Page -- http://www.php.net/manual/en/function.stripslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45469 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45469&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45469&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76231) next »