Sort array of objects by object\'s property


/ Published in: PHP
Save to your folder(s)

Used to sort array of objects by it's property

Note: Anonymous functions are available since PHP 5.3.0.


Copy this code and paste it in your HTML
  1. uasort($objects, function($a, $b) { return strcmp($a->property, $b->property); } );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.