php array_reverse keep keys code example
Example 1: php loop backwards through array
for($i = count($array) - 1; $i >= 0; $i--){
}
Example 2: php array_reverse keep keys
<?php
$input = array("php", 4.0, array("green", "red"));
$reversed = array_reverse($input);
$preserved = array_reverse($input, true);
print_r($input);
print_r($reversed);
print_r($preserved);
?>
Example 3: php loop backwards through array
$array = array_reverse($array);
foreach($array as $currentElement) {}