Php Array Keys Function
What is array_keys Function?
Explanation
The "array_keys" function returns all keys for a given array.
Syntax:
array_key(array, value, strict)
In the above syntax the "array" is the array of which all keys are displayed,there are two optional fields "value", where one can specify the values of keys to be displayed, "strict" can be "true" or "false" ,if set to "true" function will do a strict comparison.
Example :
<?php
$a = array(0 => 100, "color" => "red");
print_r(array_keys($a));
print "<br>";
$b = array(20,40,30,"20");
print_r(array_keys($b,"20",false));
?>
Result :
Array ( [0] => 0 [1] => color )
Array ( [0] => 0 [1] => 3 )
In the above example the array "$a", all the keys are displayed, but in the array "$b" only the keys of two values 20, "20" are displayed, and the matching is not done striclty as the value given is "False".