Get key and value in array php
forEach($array as $key => $value) {
echo $key; // Would output "subkey" in the example array
print_r($value);
}
Search array in key
$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red'); $key = array_search('green', $array); // $key = 2; $key = array_search('red', $array); // $key = 1;
0 comments: