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 1170 posted 9 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 1480 posted 10 years ago by CreativePunch
sort a multidimensional array by field
0 929 posted 12 years ago by akt
sort a multidimensional array by field
0 908 posted 12 years ago by akt
A nice way to do sorting of a key on a multi-dimensional array - DavidG
0 1062 posted 12 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 956 posted 12 years ago by bitsculptor
Very helpful function for sorting multi-dimensional arrays
0 970 posted 12 years ago by chasecrawford
Ordena cualquier array multidimensional en base a un campo específico
0 931 posted 12 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 1165 posted 13 years ago by Rain
0 1011 posted 13 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 1285 posted 13 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 1184 posted 13 years ago by lemcoe9
Ordena alfabéticamente el array $friends['data'] obtenido con la api de facebook.
0 1041 posted 13 years ago by serialk89
0 945 posted 13 years ago by mike_fowler
0 858 posted 13 years ago by lafayette
0 844 posted 13 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 759 posted 14 years ago by lluisr
Orders a multi-dimensional field (such as sorting multiple $orders by field 'id')
0 912 posted 14 years ago by jmiller
Simple function that sorts a bi-dimensional array by one of it keys.
1 1051 posted 14 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 914 posted 15 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 1889 posted 15 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 1608 posted 15 years ago by fackz
0 833 posted 16 years ago by iTony
« Prev 1 Next »