Sunday, March 1, 2009

Php extract method

"extract()" Method



Experimentally I found that calling extract() also shows the number of keys if the key is set and is not numeric ! Maybe there was a better definition than mine  . Please have a look to this scripts :
<?PHP
$var
["i"] = "a"
;
$var["j"] = "b"
;
$var["k"] = 1
;
echo
extract($var);
// returns 3
?>

<?PHP
$var2
["i"] = "a"
;
$var2[2] = "b"
;
$var2[] = 1
;
echo
extract($var2);
// returns 1
?>


 

(Arash Moslehi)