Page 1 of 1
PHP data structures
Posted: Fri Jun 19, 2009 5:18 pm
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
Re: PHP data structures
Posted: Fri Jun 19, 2009 6:26 pm
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.