<?php usort($arr, function($a, $b){ return strcmp($a->getBrand()->getName(), $b->getBrand()->getName()); });