asort
asort — Sort an array in ascending order and maintain index association.Description
asort( array &$array,Sorts array in place in ascending order, such that its keys maintain their correlation with the values they are associated with.
int $flags = SORT_REGULAR ): bool
This is used mainly when sorting associative arrays where the actual element order is significant.
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.
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 asort on official PHP documentation site
asort - Popular snippets
- PHP 8.0 / MySQL 8.0 asort print_r
last run:
2023-08-30 22:23:37
3
- PHP 7.4 / MySQL 5.7 print_r asort
last run:
2021-05-17 05:50:05
3
- PHP 8.1 / MySQL 5.7 file_get_contents simplexml_load_string json_encode json_decode asort round
last run:
2024-01-12 18:07:56
2
- PHP 8.1 / MySQL 5.7 file_get_contents simplexml_load_string json_encode json_decode asort print_r
last run:
2024-01-12 17:58:13
2
- PHP 8.1 / MySQL 5.7 file_get_contents simplexml_load_string json_encode json_decode asort print_r
last run:
2024-01-12 17:58:09
2
- PHP 7.4 / MySQL 5.7 print_r asort
last run:
2021-08-23 21:02:37
2
- PHP 8.1 / MySQL 5.7 simplexml_load_string json_encode json_decode explode asort print_r
last run:
2024-01-24 18:06:40
1
- PHP 8.1 / MySQL 5.7 simplexml_load_string json_encode json_decode explode asort print_r
last run:
2024-01-24 18:06:16
1
- PHP 8.1 / MySQL 5.7 file_get_contents simplexml_load_string json_encode json_decode asort round
last run:
2024-01-17 16:54:31
1
- PHP 8.1 / MySQL 5.7 asort var_dump
last run:
2024-01-13 17:33:37
1
asort - New snippets
-
PHP 8.1 / MySQL 5.7 simplexml_load_string json_encode json_decode explode asort print_r
added at:
2024-01-24 18:06:40
1
-
PHP 8.1 / MySQL 5.7 simplexml_load_string json_encode json_decode explode asort print_r
added at:
2024-01-24 18:06:16
1
-
PHP 8.1 / MySQL 5.7 file_get_contents simplexml_load_string json_encode json_decode asort round
added at:
2024-01-17 16:54:31
1
-
PHP 8.1 / MySQL 5.7 asort var_dump
added at:
2024-01-13 17:33:37
1
-
PHP 8.1 / MySQL 5.7 asort var_dump
added at:
2024-01-13 17:33:30
1
-
PHP 8.1 / MySQL 5.7 asort var_dump
added at:
2024-01-13 17:32:49
1
-
PHP 8.1 / MySQL 5.7 asort var_dump
added at:
2024-01-13 17:32:22
1
-
PHP 8.1 / MySQL 5.7 asort var_dump
added at:
2024-01-13 17:32:18
1
-
PHP 8.1 / MySQL 5.7 var_dump asort
added at:
2024-01-13 17:32:10
1
-
PHP 8.1 / MySQL 5.7 var_dump asort
added at:
2024-01-13 17:32:02
1