sort
sort — Sort an array in ascending order.Description
sort( array &$array,Sorts array in place by values in ascending order.
int $flags = SORT_REGULAR ): bool
Note:
If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
This function assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys.
Resets array's internal pointer to the first element.
Parameters
array
The input array.
flags
The optional second parameter flags can be any of the following values: SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_LOCALE_STRING, SORT_NATURAL, SORT_FLAG_CASE or SORT_STRING_CASE. If no flag is given, the sort is done in ascending order (bubble sort algorithm). The SORT_STRING_CASE flag is available since PHP 5.4.0.
Return Values
Always returns true.More information about sort on official PHP documentation site
sort - Popular snippets
- PHP 8.2.13 / MySQL 5.7 rand print_r sort array_count_values
last run:
2023-08-22 16:55:49
60
- PHP 8.2.13 / MySQL 5.7 rand print_r sort array_count_values
last run:
2023-08-22 16:28:07
29
- PHP 8.2.13 / MySQL 5.7 rand print_r sort array_count_values
last run:
2023-08-22 16:29:09
11
- PHP 8.0 / MySQL 5.7 print_r sort
last run:
2023-05-23 13:04:12
8
- PHP 8.1 / MySQL 5.7 sort memory_get_peak_usage range
last run:
2024-01-02 19:50:03
7
- PHP 8.1 / MySQL 5.7 array_map explode sort print_r
last run:
2022-05-11 03:24:50
6
- PHP 5.6 / MySQL 5.7 array_shift sort preg_match
last run:
2022-03-31 06:16:50
6
- PHP 8.1 / MySQL 5.7 sort memory_get_peak_usage range
last run:
2024-01-02 19:51:46
4
- PHP 8.1 / MySQL 5.7 rand sort print_r
last run:
2023-08-22 14:22:47
4
- PHP 8.1 / MySQL 5.7 sort json_encode
last run:
2023-03-16 19:28:58
4
sort - New snippets
-
PHP 7.4 / MySQL 5.7 ini_set microtime range shuffle sort
added at:
2024-11-18 17:41:14
1
-
PHP 8.1 / MySQL 5.7 ini_set microtime range shuffle sort
added at:
2024-11-18 17:41:06
1
-
PHP 8.2.13 / MySQL 5.7 ini_set microtime range shuffle sort
added at:
2024-11-18 17:40:38
3
-
PHP 8.2.13 / MySQL 5.7 ini_set microtime range shuffle sort
added at:
2024-11-18 17:40:00
3
-
PHP 8.1 / MySQL 5.7 ini_set microtime range shuffle sort
added at:
2024-11-18 17:39:54
2
-
PHP 8.1 / MariaDB 11.4 file_get_contents json_decode sort print_r
added at:
2024-10-23 16:35:26
1
-
PHP 8.1 / MySQL 5.7 sort
added at:
2024-07-13 14:13:32
1
-
PHP 8.1 / MySQL 5.7 print_r sort
added at:
2024-06-22 07:55:47
1
-
PHP 8.2.13 / MySQL 8.0 var_export sort
added at:
2024-04-28 22:02:22
1
-
PHP 8.1 / MySQL 5.7 array_values sort print_r
added at:
2024-04-16 17:37:12
1