Queue and stack implementation in PHP