Does PHP have built-in data structures?

Thomas Owens picture Thomas Owens · Aug 22, 2008 · Viewed 51.1k times · Source

I'm looking at the PHP Manual, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in?

Answer

Vincent picture Vincent · Aug 22, 2008

The only native data structure in PHP is array. Fortunately, arrays are quite flexible and can be used as hash tables as well.

http://www.php.net/array

However, there is SPL which is sort of a clone of C++ STL.

http://www.php.net/manual/en/book.spl.php