I've this kind of array
Array
(
[12-12] => 9
[01-13] => 10
[02-13] => 11
[03-13] => 14
[05-13] => 16
[09-13] => 17
)
with a simple
foreach ($arr as $key=>$value)
i can access every key and element.
But i need to get, from second element, also previous element:
$i=1;
foreach ($arr as $key=>$value) {
if ($i==1) {
echo $key .'=> 0 '. $value;
} else {
echo $key .'=>'. $arr[$key-1] .'=>'. $value;
}
$i++
}
I need so to print a similar thing:
12-12 => 0 => 9
01-13 => 9 => 10
02-13 => 10 => 11
and so on
"Obviously" it doesn't function, because of string key. Any help? Thank you!