As foo, bar & baz all have the same priority their order is undefined, so they could come out in any order. See the note here http://www.php.net/manual/en/splpriorityqueue.compare.php
Note:
Multiple elements with the same priority will get dequeued in no particular order.
and the top user note on the same page for a suggested solution http://www.php.net/manual/en/splpriorityqueue.compare.php#93999
There is also a blog post on Matthew Weier O'Phinney's Blog which you may find useful.