Friday 27 March 2015

PHP: What's different with SplFixedArray, and is it best to use?

SplFixedArray is as the name says a fixed size array: You specify the size in the constructor and can only change it later using ->setSize(). But it is not changed automatically. Also you can only use integers as indexes (=> no assoc arrays).

So you can't always use an SplFixedArray when you're using a PHP array (and also shouldn't). But if you are having really large arrays that do not change, then using it can save you some memory.

0 comments:

Post a Comment