usort is very useful when one wants to combine or manipulate the results especially received from the db.

say for example we have an array named $displayProduct and we want to sort by the associative array call ‘order’

usort($displayProduct, function($a, $b) {return ($a['order'] < $b['order']) ? -1 : 1; });
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz