Home >PHP MYSQL
PHP AddSlashes to an Array
Author: Alan Reddan
February 2006

Say you have a $_POST array and and you don't know if magic quotes is on:

Then simply call this routine and your entire array is reslashed if magic quotes are off or its left alone if they are turned on.

array_walk($_POST, 'reslash_multi');

function reslash_multi(&$val,$key)
{
   if (is_array($val)) array_walk($val,'reslash_multi',$new);
   else {
      $val = reslash($val);
   }
}


function reslash($string)
{
   if (!get_magic_quotes_gpc())$string = addslashes($string);
   return $string;
}



Date Title
11/12/2007 Setup PHP SSH2 Connection from php to remote box on pair networks
1. Download modules http://www.php.net/download
20/02/2006 Serialised Array Walk
This is an array_walk style serialize that works
February 2006 PHP AddSlashes to an Array
Say you have a $_POST array and and you don't know
04/01/2006 MYSQL Select time from a date
Consider you have a date field in mysql of format
 
     
   

site developed by silverarm solutions 10. php mysql development ireland