note 33441 added to language.references

From: Date: Thu, 26 Jun 2003 04:09:57 +0000
Subject: note 33441 added to language.references
Groups: php.notes 
Request: Send a blank email to php-notes+get-51023@lists.php.net to get a copy of this message
I've created a simple function which could be used to refine $_POST array recursively, which is done by passing by reference. <?php // Usage: refine($_POST); // Strips whitespaces from the beginning and end of the input string. // Strips slashesand HTML and PHP tags from the input string. function refine(&$input) { while (list($key, $val) = each($input)) { if (!is_array($val)) { $val = stripslashes(trim($val)); $val = strip_tags($val); // do some work to refine data here... $input[$key] = $val; } else { refine($input[$key]); } } } ?> Any suggestions and improvements will be welcomed. ---- Manual Page -- http://www.php.net/manual/en/language.references.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33441 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33441&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33441&report=yes

« previous php.notes (#51023) next »