Deque Implentation in PHP