Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged sort



« Prev 1 Next »
Sort & query arrays in PHP. Sort multi dimensional arrays by object properties and filter the array by specific criteria. Documentation: https://github.com/mattnicholson/DataList
1 2233 posted 11 years ago by mattnicholson
Creating a nested array from items with parent IDs. This is useful for when you have a website working with multiple categories with parent categories. But it can be applied anywhere, really!
0 3803 posted 12 years ago by CreativePunch
sort a multidimensional array by field
0 1905 posted 14 years ago by akt
sort a multidimensional array by field
0 1834 posted 14 years ago by akt
A nice way to do sorting of a key on a multi-dimensional array - DavidG
0 2211 posted 14 years ago by satie83
This sorts a multi-dimensional array by one of the values in the array. Sorts in Desc order (most recent date first).
0 1997 posted 14 years ago by bitsculptor
Very helpful function for sorting multi-dimensional arrays
0 1974 posted 14 years ago by chasecrawford
Ordena cualquier array multidimensional en base a un campo específico
0 1972 posted 14 years ago by n19ht
Used to sort array of objects by it's property Note: Anonymous functions are available since PHP 5.3.0.
0 2268 posted 14 years ago by Rain
0 2037 posted 14 years ago by wanchun0222
1. Get Posts however you see fit 2. Loop through the posts getting the terms from taxonomies and add them to the Post object 3. Sort the Array of Post Objects by the property you want them sorted by using sort_on_field()
0 2431 posted 14 years ago by kingkool68
There seems to be no easy way to insert a key and value at the beginning of an array, as array_unset does not allow you to specify a key. This is not a very efficient way to do it, but it works. Pretend the array is currently: array("a"=>"b", "c"...
0 2455 posted 14 years ago by lemcoe9
Ordena alfabéticamente el array $friends['data'] obtenido con la api de facebook.
0 2966 posted 15 years ago by serialk89
0 1965 posted 15 years ago by mike_fowler
0 1983 posted 15 years ago by lafayette
0 1713 posted 15 years ago by takel
searching for a date sort function I found: http://slevy1.wordpress.com/2010/06/30/sorting-date-strings-in-php/ and built my codeigniter helper call : $arrSortedDates = bubbleSort( $unsorted ); (previous->helper autoload)
0 1559 posted 15 years ago by lluisr
Orders a multi-dimensional field (such as sorting multiple $orders by field 'id')
0 1826 posted 15 years ago by jmiller
Simple function that sorts a bi-dimensional array by one of it keys.
1 2165 posted 16 years ago by AlejoLuc
This code replaces a normal category template. It sorts all posts by their category/subcategory instead of bunching them all together and ordering them by date. A bit complicated to explain in a box this size... Check the link for a run through!
1 2247 posted 17 years ago by rocktronica
Put this before the loop in archive.php to have posts in the archive for category '26' sorted by custom field 'date'. Assign sortable values like '090501' or '2009-05-01' to those fields when editing posts and your Upcoming Events will be sorted by...
8 3429 posted 17 years ago by hussong
This is a function that selects files from a directory and orders them by the last time they were changed, in ascending or descending order. The snippet also calculates how much time passed since the file’s content was changed.
2 2951 posted 17 years ago by fackz
0 1773 posted 17 years ago by iTony
« Prev 1 Next »