Reversing an Array in PHP


Reverse the order of the elements in an array with array_reverse().

Source Code

$numbers = [1, 2, 3, 4, 5];
$reversed = array_reverse($numbers);
print_r($reversed);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments