Is there an equivalent to C++'s std::vector in PHP?

arrays, performance, php

Solution

Have a look at SPL datastructures. An example is http://www.php.net/manual/en/class.splfixedarray.php which is faster than normal array.

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

Problem

Is there a lightweight replacement for PHP's `array` to be used when I don't need any of the associated array functionality? From what I know, `array` is a hash map internally, which is excessive and inefficient for storing a simple array of elements. If PHP had a class or programming construct similar to C++'s `std::vector`, it would be just great. Reference: http://www.cplusplus.com/reference/vector/vector/

Original source