——Get the collection of key names in the array.
//Parameter 1: Array to be retrieved; Parameter 2: Key value to be retrieved. Default is NULL; Parameter 3: Whether to strictly compare (===), default is false. Parameter 3 was added in php5.0
<span style="color: #800080">$arr1</span> = <span style="color: #0000ff">array</span><span style="color: #000000">( </span>'a'=>'apple', 'b'=>'banana', 'f'=><span style="color: #0000ff">false</span>, 'b1'=><span style="color: #0000ff">false</span>, 'b2'=><span style="color: #0000ff">false</span>, 'b3'=>'false', 'b4'=><span style="color: #0000ff">true</span>, 'num1'=>1, 'num2'=>'1'<span style="color: #000000"> ); </span><span style="color: #008000">//</span><span style="color: #008000">var_dump(array_keys($arr1, 'banana');</span> <span style="color: #008080">var_dump</span>(<span style="color: #008080">array_keys</span>(<span style="color: #800080">$arr1</span>, 1, <span style="color: #0000ff">false</span>));
Output: array(3) { [0]=> string(2) "b4" [1]=> string(4) "num1" [2]=> string(4) "num2" }
There is no strict comparison. true at index 'b4' is also treated as 1.