PHP data structures

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ricardino
Forum Newbie
Posts: 2
Joined: Fri May 29, 2009 6:00 pm

PHP data structures

Post by ricardino »

Hi all. As a programmer migrating across from C#/Java Programming i know this might be a bit obvious, but does PHP have an equivalent to a C# stack or queue data structure?
any help would be appreciated
thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP data structures

Post by requinix »

Arrays. They work as queues, stacks, lists (vectors, linked lists, doubly-linked lists), dictionaries/hashes...

array_push adds to the end of the array, array_unshift to the front; array_pop removes from the end, array_shift from the front.
Then reset, next, prev, current, and key to use them as linked lists.
Post Reply