UK ['ki:z] US ['ki:z]

n.Key; key; (of music) key (plural noun of key); solution

php array_keys() function syntax

Function: Returns a new array containing all key names in the array.

Syntax: array_keys(array,value,strict)

##Parameters:

ParametersDescriptionarrayRequired. Specifies an array. value Optional. You can specify a key value, and then only the key name corresponding to that key value will be returned.​ #strictOptional. Used with the value parameter. Possible values: true - Returns the key name with the specified key value. Depending on the type, the number 5 is not the same as the string "5". false - the default value. Independent of type, the number 5 is the same as the string "5".

Description: Returns a new array containing all the key names in the array. If the second argument is provided, only the key names whose key value is this value are returned. If the strict parameter is specified as true, PHP will use equality comparison (===) to strictly check the data type of the key value.

php array_keys() function example

<?php
$a = array("class" => "php中文网","name" => "西门","job" => "讲师");
print_r(array_keys($a));
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

Array ( [0] => class [1] => name [2] => job )


<?php
$a = array("class" => "php中文网","name" => "无忌哥哥","job" => "考官");
print_r(array_keys($a));
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Array ( [0] => class [1] => name [2] => job )