get keys of an array in php code example
Example 1: php all keys in array
<?php
$array = array(
'fruit1' => 'apple',
'fruit2' => 'orange',
'fruit3' => 'grape',
'fruit4' => 'apple',
'fruit5' => 'apple');
$keys = array_keys($array); // return array
$values = array_values($array); // return array
?>
Example 2: get array key php
array_keys ($array);
// It returns an array
// more informations at https://www.php.net/manual/fr/function.array-keys.php (fr)