You want the php function “asort”:
http://php.net/manual/en/function.asort.php
it sorts the array, maintaining the index associations.
Edit: I’ve just noticed you’re using a standard array (non-associative). if you’re not fussed about preserving index associations, use sort():
http://php.net/manual/en/function.sort.php
Related Contents:
- How to order “zebra” array so each key has an alternate value (either 1, 0)
- How can I sort arrays and data in PHP?
- How to Sort a Multi-dimensional Array by Value
- How to sort an array of associative arrays by value of a given key in PHP?
- Sort an Array by keys based on another Array?
- Sort array of objects by object fields
- Sort multidimensional array by multiple columns
- PHP Sort a multidimensional array by element containing Y-m-d H:i:s date
- PHP Sort Array By SubArray Value
- Sorting an associative array in PHP [duplicate]
- glob() – sort array of files by last modified datetime stamp
- Find a matching or closest value in an array
- Sorting a php array of arrays by custom order
- PHP sort array by two field values [duplicate]
- Sorting a multidimensional array in PHP? [duplicate]
- Preserve key order (stable sort) when sorting with PHP’s uasort
- How do I sort a multidimensional array by one of the fields of the inner array in PHP? [duplicate]
- Group array by subarray values
- PHP array multiple sort – by value then by key?
- How to sort a date array in PHP
- Sort array of objects by one property
- How to sort a multidimensional array by a certain key?
- How to GROUP BY and SUM PHP Array? [duplicate]
- How to sort an array of UTF-8 strings?
- Sort an array by a child array’s value in PHP
- Sort a flat, associative array by numeric values, then by non-numeric keys
- PHP Get Highest Value from Array
- Group rows in an associative array of associative arrays by column value and preserve the original first level keys
- Sort array of objects by date field
- Sort an array of associative arrays by column value
- scandir() to sort by date modified
- How to sort date array in php?
- How can I sort an array of UTF-8 strings in PHP?
- Recursively sort keys of a multidimensional array
- Using usort in php with a class private function
- Isolate comma-separated values, remove duplicates and empty values, then sort
- Sort Object in PHP [duplicate]
- Sort multidimensional array by date column, then use other column values if dates are the same
- How to sort an array of arrays in php?
- Custom key-sort a flat associative based on another array
- Modify array values in foreach loop
- How to use a string as an array index path to retrieve a value?
- More concise way to check to see if an array contains only numbers (integers)
- Transpose 2d array, join second level with commas, and join first level with pipes
- Remove all elements from array that do not start with a certain string
- PHP Random Shuffle Array Maintaining Key => Value
- Looping a multidimensional array in php
- Casting an Array with Numeric Keys as an Object
- Returning Multiple Rows with MySqli and Arrays
- Split array into two arrays by index even or odd