note 75072 added to function.stripslashes

From: Date: Fri, 11 May 2007 00:33:25 +0000
Subject: note 75072 added to function.stripslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-126398@lists.php.net to get a copy of this message
I wrote a recursive stripslashes() that uses references so as to use as little extra RAM as possible, even on large amounts of data. It's extremely useful for annihilating magic_quotes where a simple 'please' won't do the trick. <?php /** * Created specifically for wiping out magic_quotes but probably has uses for other things too * @param mixed $input A reference to a string or array * @return void Modifies the parameter supplied */ function stripslashes_recurse(&$input) { if(is_array($input)) { foreach($input as &$element) { $this->stripslashes_recurse(&$element); } } elseif(is_string($input)&&!empty($input)) { $input=stripslashes($input); } } ?> Example usage: <?php stripslashes_recurse(&$_GET); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 76.23.29.153 ---- Manual Page -- http://www.php.net/manual/en/function.stripslashes.php Edit -- https://master.php.net/note/edit/75072 Del: integrated -- https://master.php.net/note/delete/75072/integrated Del: useless -- https://master.php.net/note/delete/75072/useless Del: bad code -- https://master.php.net/note/delete/75072/bad+code Del: spam -- https://master.php.net/note/delete/75072/spam Del: non-english -- https://master.php.net/note/delete/75072/non-english Del: in docs -- https://master.php.net/note/delete/75072/in+docs Del: other reasons-- https://master.php.net/note/delete/75072 Reject -- https://master.php.net/note/reject/75072 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126398) next »