58 of 110 menu

Reverse an Array in PHP

You can reverse an array in PHP using the array_reverse function. See the example:

<?php $arr = [1, 2, 3, 4, 5]; $arr = array_reverse($arr); var_dump($arr); ?>

Code execution result:

[5, 4, 3, 2, 1]
English
БеларускаяEspañolРусский
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline