php using sorting methods

class Newclass
{
 
public static function compare($a, $b)
{
return strcmp($a["name"], $b["name"]);
}
 
}
 
usort($array_to_srt, array("Newclass", "compare"));
 
 
 
uasort($array_to_srt, array("Newclass", "compare"));
 
The difference between usort and uasort is that uasort keeps the keys, usort resets them and enumerate from scratch.

Leave a Reply