php reverse array
snippet in php

php reverse array

user3512

$array= array(1,2,3,4,5);
$reversedArray = array_reverse($array);

var_dump($y);

php foreach reverse

user6494

foreach(array_reverse($array) as $var) {
	echo $var // Will show in reversed order
}

array reverse php

user4533

array_reverse($array);

php array_reverse keep keys

user8590


<?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);
?>