


Commonly used array functions in php (5) (getting a collection of key names in an array)
Oct 28, 2016 pm 03:03 PMarray_keys($arr, $search_value, $strict);
——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.

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)