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 963 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 1192 posted 10 years ago by CreativePunch
sort a multidimensional array by field
0 706 posted 11 years ago by akt
sort a multidimensional array by field
0 710 posted 11 years ago by akt
A nice way to do sorting of a key on a multi-dimensional array - DavidG
0 837 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 742 posted 12 years ago by bitsculptor
Very helpful function for sorting multi-dimensional arrays
0 755 posted 12 years ago by chasecrawford
Ordena cualquier array multidimensional en base a un campo específico
0 735 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 943 posted 12 years ago by Rain
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 1048 posted 12 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 937 posted 12 years ago by lemcoe9
Ordena alfabéticamente el array $friends['data'] obtenido con la api de facebook.
0 847 posted 12 years ago by serialk89
0 724 posted 13 years ago by mike_fowler
0 673 posted 13 years ago by lafayette
0 670 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 598 posted 13 years ago by lluisr
Orders a multi-dimensional field (such as sorting multiple $orders by field 'id')
0 735 posted 13 years ago by jmiller
Simple function that sorts a bi-dimensional array by one of it keys.
1 850 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 726 posted 14 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 1612 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 1392 posted 15 years ago by fackz
0 649 posted 15 years ago by iTony
« Prev 1 Next »