How to clear some php variable (not all php variable) using PHP ?
i have many php variable
EG: $a,$b,$c,$d.$e,$f,$g,$h,$i,$j
i want to clear all php variable and not clear $a,$c,$d
i use this code but not work, how can i do ?
<?PHP
$a = "1";
$b = "2";
$c = "3";
$d = "4";
$e = "5";
$f = "6";
$g = "7";
$h = "8";
$i = "9";
$j = "10";
$dontDelete = array('a' , 'c' , 'd');
foreach ($ as $key=>$val)
{
if (!in_array($key,$dontDelete))
{
unset($[$key]);
}
}
?>
$arr = get_defined_vars();$in theforeachline would give you error.