only keys in php array 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);
$values = array_values($array);
?>
Example 2: php keys of array
$array = array(0 => 100, "cor" => "vermelho");
print_r(array_keys($array));
$array = array("azul", "vermelho", "verde", "azul", "azul");
print_r(array_keys($array, "azul"));
$array = array("cor" => array("azul", "vermelho", "verde"),
"tamanho" => array("pequeno", "medio", "grande"));
print_r(array_keys($array));