PHP - array_reverse
Trieda
Metóda - array_reverse
(PHP 4, PHP 5, PHP 7)
Reverses values in the array so that the first value is the last and vice versa.
Procedurálne
- function array_reverse (array $array, bool $preserve_keys = false) : array
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $array | array | An input array. | |
| $preserve_keys | bool | false | As the second optional parameter, we can set if numeric keys are preserved. If the value is TRUE, they are not renumbered. |
Mávratovej hodnoty
Vracia: array
A reversed array.
Príklady
<?php
$array = [1, 2, 3, 4];
$reversed = array_reverse($array);
print_r($reversed);
Súvisiace manuály
- function array_flip (array $array) : array
