Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 31, 2019 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/8ea3c1a0a9cc2b89d9c4666ba4a42dbc to your computer and use it in GitHub Desktop.
Save parzibyte/8ea3c1a0a9cc2b89d9c4666ba4a42dbc to your computer and use it in GitHub Desktop.
<?php
$arreglo = [
"2019-07-30 07:00:00",
"2002-11-24 13:15:20",
"2007-10-29 15:27:32",
];
echo "Arreglo antes de ordenar: ";
print_r($arreglo);
sort($arreglo, SORT_STRING);
echo "Arreglo DESPUÉS de ordenar: ";
print_r($arreglo);
/*
Salida:
Arreglo antes de ordenar: Array
(
[0] => 2019-07-30 07:00:00
[1] => 2002-11-24 13:15:20
[2] => 2007-10-29 15:27:32
)
Arreglo DESPUÉS de ordenar: Array
(
[0] => 2002-11-24 13:15:20
[1] => 2007-10-29 15:27:32
[2] => 2019-07-30 07:00:00
)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment