PHP Reverse Array
$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);
var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);
#The original array
arr = [11, 22, 33, 44, 55]
print("Array is :",arr)
res = arr[::-1] #reversing using list slicing
print("Resultant new reversed array:",res)
const array1 = ['one', 'two', 'three'];
console.log('array1:', array1);
// expected output: "array1:" Array ["one", "two", "three"]
const reversed = array1.reverse();
console.log('reversed:', reversed);
// expected output: "reversed:" Array ["three", "two", "one"]
// Careful: reverse is destructive -- it changes the original array.
console.log('array1:', array1);
// expected output: "array1:" Array ["three", "two", "one"]
int[] intArray = { 1, 2, 3, 4, 5 };
ArrayUtils.reverse(intArray);
System.out.println(Arrays.toString(intArray));
//[5, 4, 3, 2, 1]
[ "a", "b", "c" ].reverse #=> ["c", "b", "a"]
[ 1 ].reverse #=> [1]