Created
August 7, 2019 18:35
-
-
Save parzibyte/8566fa64f05f500309edc16f8e05205c to your computer and use it in GitHub Desktop.
Invertir un arreglo en PHP - https://parzibyte.me/blog/2018/10/15/invertir-arreglo-php/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$numeros = [1, 2, 3]; | |
$frutas = ["Limón", "Manzana", "Naranja"]; | |
echo "Antes de invertir..."; | |
echo "Números:\n"; | |
print_r($numeros); | |
echo "Frutas:\n"; | |
print_r($frutas); | |
# Invertir arreglos | |
$numeros = array_reverse($numeros); | |
$frutas = array_reverse($frutas); | |
echo "Después de invertir..."; | |
echo "Números:\n"; | |
print_r($numeros); | |
echo "Frutas:\n"; | |
print_r($frutas); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment