How can I sort this array of objects by one of its fields, like name or count ?
name
count
Array ( [0] => stdClass Object (
if you want to sort dates
usort($threads,function($first,$second){ return strtotime($first->dateandtime) < strtotime($second->dateandtime); });