PHP обратный массив
$array= array(1,2,3,4,5);
$reversedArray = array_reverse($array);
var_dump($y);
Annoyed Albatross
$array= array(1,2,3,4,5);
$reversedArray = array_reverse($array);
var_dump($y);
foreach(array_reverse($array) as $var) {
echo $var // Will show in reversed order
}
<?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);
?>
<?php
$i_arr = ["html", "css", "javascript", "php", "vue", "react"];
echo "<pre>";
print_r($i_arr);
echo "</pre>";
$reverse = array_reverse($i_arr, false);
$preserve = array_reverse($i_arr, true);
echo "<pre>";
print_r($reverse);
echo "</pre>";
echo "<pre>";
print_r($preserve);
echo "</pre>";
?>
$array= array(1,2,3,4,5);
$reversedArray = array_reverse($array);
// [5,4,3,2,1]