note 82119 added to function.addslashes

From: Date: Fri, 28 Mar 2008 05:56:01 +0000
Subject: note 82119 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-137655@lists.php.net to get a copy of this message
i think we all know that addslashes() and stripslashes() just dont work if you have an array, here is a function you can use for either array's or for typical variables. <?php function adslashes($array) { if(is_array($array)){ foreach($array as $key => $val){ if(is_array($key) { return adslashes($key); } else { $return[$key] = stripslashes($val); // recurse } } return($return); } else{ return(addslashes($array)); // return slash'ed value } } ?> ---- Server IP: 59.162.86.33 Probable Submitter: 122.169.40.153 ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- https://master.php.net/note/edit/82119 Del: integrated -- https://master.php.net/note/delete/82119/integrated Del: useless -- https://master.php.net/note/delete/82119/useless Del: bad code -- https://master.php.net/note/delete/82119/bad+code Del: spam -- https://master.php.net/note/delete/82119/spam Del: non-english -- https://master.php.net/note/delete/82119/non-english Del: in docs -- https://master.php.net/note/delete/82119/in+docs Del: other reasons-- https://master.php.net/note/delete/82119 Reject -- https://master.php.net/note/reject/82119 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137655) next »