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 2193 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 3756 posted 12 years ago by CreativePunch
sort a multidimensional array by field
0 1862 posted 14 years ago by akt
sort a multidimensional array by field
0 1786 posted 14 years ago by akt
A nice way to do sorting of a key on a multi-dimensional array - DavidG
0 2184 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 1964 posted 14 years ago by bitsculptor
Very helpful function for sorting multi-dimensional arrays
0 1935 posted 14 years ago by chasecrawford
Ordena cualquier array multidimensional en base a un campo específico
0 1922 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 2230 posted 14 years ago by Rain
0 1998 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 2390 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 2426 posted 14 years ago by lemcoe9
Ordena alfabéticamente el array $friends['data'] obtenido con la api de facebook.
0 2931 posted 14 years ago by serialk89
0 1926 posted 15 years ago by mike_fowler
0 1948 posted 15 years ago by lafayette
0 1676 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 1539 posted 15 years ago by lluisr
Orders a multi-dimensional field (such as sorting multiple $orders by field 'id')
0 1794 posted 15 years ago by jmiller
Simple function that sorts a bi-dimensional array by one of it keys.
1 2122 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 2205 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 3362 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 2903 posted 17 years ago by fackz
0 1748 posted 17 years ago by iTony
« Prev 1 Next »