Previous | Home | Next |
array_keys()
The array_keys() function returns an array containing the keys.
Syntax:array_keys(array,value,strict)
In above syntax,"array" specifies an array, "value" specifies the value then only the keys with this value are returned, "strict" is used with the value parameter and values are as follows:
- true - Returns the keys with the specified value, depending on type: the number 5 is not the same as the string "5".
- false - Default value. Not depending on type, the number 5 is the same as the string "5".
Example:
<?php $a=array("Apple"=>"fruit","Mango"=>"fruit","Banana"=>"fruit"); print_r(array_keys($a)); ?>
Output:
Previous | Home | Next |