News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

LivePipe Blog:
Complex Sorting with PHP
June 28, 2007 @ 07:11:21

On the LivePipe blog today, there's a quick new article demonstrating a sorting method that can be used for more than just simple datasources:

Most often when I need to sort complex data sets, I'm using some sort of SQL backend. Today I needed to do complex sorting of Reflection objects for some auto generating documentation I'm working on for the upcoming Picora release. [...] In the usort() examples, I had always been under the assumption that the return values had to be 0, 1 or -1. Today I learned that is not true at all, and you can come up with your own scoring system with any range, negative or positive.

He illustrates the point with a simple example showing the sorting of the documentation for Picora. In his protected function, scoreFromMethod, he defines the return array with several values instead of just the one.

0 comments voice your opinion now!
complex sort usort example picora complex sort usort example picora


blog comments powered by Disqus

Similar Posts

Pierre-Alain Joye's Blog: how to do not work around filter (don't be lazy :)

Jacob Santos' Blog: phpBB is Dead, Long Live FUDForum (or at least SMF)

Richard Thomas' Blog: jQPie 0.3 released

Jackson Miller\'s Blog: PHP vs. Ruby (on Installation)

Dave Marshall's Blog: Traits in PHP 5.4 - HelloWorld with Logging Trait


Community Events





Don't see your event here?
Let us know!


podcast interview community configure api series release list application code introduction library bugfix laravel threedevsandamaybe developer unittest wordpress language install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework