Hi Thank for reply , the following code seem to not work with the array type. =)
<?
$testString = "This is a String''";
$testArray = array("Key1" => "Value1" , "Key2" => "Value2");
function input_var($var)
{
function cleanup($arg)
{
$arg = trim($arg);
$arg = strip_tags($arg);
$arg = addslashes($arg);
return $arg;
}
if (is_string($var)) {$var = cleanup($var);}
if (is_array($var)) {$var = array_map('cleanup', $var);}
return $var;
}
$output1 = input_var($testString);
echo $output1;
$output2 = input_var($testArray);
echo $output2[0];
?>
And it output the error
This is a String\'\'
Fatal error: Cannot redeclare cleanup() (previously declared in f:\localhost\www\test.php:6) in f:\localhost\www\test.php on line 6