how to get value with key in associative array 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: php array_values
<?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>
// ["XL","gold"]