$go = [test1,test2,test3]
foreach($go as $key => $val){
echo $key;
echo $val;
}
3 test3, 2 test2, 1 test1
1 test3, 2 test2, 3 test1
<?php
$go = ['test1','test2','test3'];
print_r(array_reverse($go, true));
Array ( [2] => test3 [1] => test2 [0] => test1 )
<?php
$go = ['test1','test2','test3'];
for ($i=count($go)-1; $i>=0; $i--) {
echo $i.' => '.$go[$i].'<br>';
}
2 => test3
1 => test2
0 => test1
$array = ["zero", "one", "two", "three", "four"];
for (end($array); ($key = key($array)) !== null; prev($array) ) {
print($key . " : " . current($array) . "\n");
}