I am trying to sort vote-list in PHP.
The list is an array, containing class-objects:
Array
(
    [0] => VotedSong Object
        (
            [title] => SimpleXMLElement Object
                (
                    [0] => bbh - bghs dsdw
                )
            [votes] => SimpleXMLElement Object
                (
                    [0] => 6
                )
            [key] => SimpleXMLElement Object
                (
                    [0] => bbh--0
                )
        )
    [1] => VotedSong Object
        (
            [title] => SimpleXMLElement Object
                (
                    [0] => aaa - bbb
                )
            [votes] => SimpleXMLElement Object
                (
                    [0] => 4
                )
            [key] => SimpleXMLElement Object
                (
                    [0] => aaa--0
                )
        )
    [2] => VotedSong Object
        (
            [title] => SimpleXMLElement Object
                (
                    [0] => wdewv - qwdqs
                )
            [votes] => SimpleXMLElement Object
                (
                    [0] => 3
                )
            [key] => SimpleXMLElement Object
                (
                    [0] => wdewv--0
                )
        )
    [3] => VotedSong Object
        (
            [title] => SimpleXMLElement Object
                (
                    [0] => Hsg and fdSv - aGamaama
                )
            [votes] => SimpleXMLElement Object
                (
                    [0] => 2
                )
            [key] => SimpleXMLElement Object
                (
                    [0] => hsgandfdsv--0
                )
        )
)
I managed to sort there by the ->key wich is working fine:
usort($votedsongs, function ($a, $b) { return $b->votes - $a->votes; });
But after this, I still need another sort-function to sort those songs that have the same amout of votes by ->title.
I already found some solutions that deal with problems alike, but those did not work for me.
Any ideas on this?
 
    