php array echo value of key code example
Example 1: php foreach echo key value
foreach($page as $key => $value) {
echo "$key is at $value";
}
Example 2: 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
?>