Home > Article > Backend Development > PHP function array_keys() returns a new array containing all the key names in the array
Example
Returns a new array containing all the key names in the array:
<?php $a=array("Volvo"=>"XC90","BMW"=>"X5","Toyota"=>"Highlander"); print_r(array_keys($a)); ?>
Definition and usage
array_keys() function returns the value containing A new array of all keys in the array.
Syntax
array_keys(array,value,strict)
Parameters | Description |
array | Required. 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. |
strict | Optional. Used with the value parameter. Possible values:
|
Technical details
Return value: | Returns a new array containing all keys in the array. |
PHP Version: | 4+ |
##Update Log : | The strict parameter isnew in PHP 5.0. |
The above is the detailed content of PHP function array_keys() returns a new array containing all the key names in the array. For more information, please follow other related articles on the PHP Chinese website!