Forum Moderators: coopster
$arr['20200130'][0] = array('2.10', 'foo');
$arr['20200130'][1] = array('2.11', 'bar');
$arr['20200129'][2] = array('2.09', 'lorem');
...
$arr['20190201'][1500] = array('2.14', 'ipsum'); foreach ($arr as $key) {
$top = $arr[$key][0];
break;
} The second dimension will always be in the right order for my purposes, but the first dimension can vary.
// resets $arr to first element and returns the first value of $arr
$subArray = reset($arr);
$value = $subArray[0];
print_r($value);
Array
(
[0] => 2.10
[1] => foo
)
$value = reset($arr)[0];
$key = key($arr);
list($value, $string) = $arr[$key][0]; I don't think I'd seen the reset() function before, and would have never thought to consider it based on the name.
...and found that key($arr) would give me the first key
TIMTOWTDI!