On PHPMaster.com today there's a new tutorial - the first part in a series - looking at data structures. In this first post Ignatius Teo looks at the concepts of "stacks" and "queues".
Most of us are familiar with "stacks" and "queues" in normal everyday usage. But, what do supermarket queues and vending machines have to do with data structures? Let's find out. In this article, I will introduce you to two basic abstract data types - the Stack and the Queue - which have their conceptual origins in everyday usage.
He introduces some of the common concepts behind these two ideas and includes some sample code showing how to implement them. He also mentions some of the SPL functionality that's bult into PHP to handle some of this. The SplStack and SplQueue objects take some of the hassle out of it for you.