0

I want to sort a array containing objects as follows:

$object = new object();
$object->time = "10:30";
$object2 = new object();
$object2->time = "9:30";
$array = array($object, $object2);

What is the most efficient way to organize the array so that the first object is the earliest time??

Thanks for help.

Reco Jhonatan
  • 1,059
  • 3
  • 16
  • 28
  • See: http://stackoverflow.com/q/17364127/3933332 you probably want to use `usort()` – Rizier123 Jan 04 '17 at 23:54
  • $object = new object(); $object->time = "10:30"; $object2 = new object(); $object2->time = "9:30"; $array = array($object, $object2); $collection = collect($array); $collection->orderBy('time','ASC'); – Akram Wahid Jan 05 '17 at 06:02

0 Answers0