-陣列中取得鍵名的集合。
//參數1 要擷取的陣列;參數2 要擷取的鍵值 預設NULL;參數3 是否嚴格比較(===)預設false。參數3是在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>));
輸出:array(3) { [0]=> string(2) "b4" [1]=> string(4) "num1" [2]=> string(4) "num2" }
沒有嚴格比較。索引'b4'的true 也被當作1。