Can PHP arrays hold items of different type?

According to the PHP manual you can indeed store heterogeneous types inside a PHP "array" - scroll down to example 3.

Note that even though the example is about keys being ints or strings, the values assigned in the example are also both ints and strings, demonstrating that it is possible to store heterogeneous types.

Be aware that in the case of different-typed keys there is automatic casting involved so you may have surprising results in the case where e.g. a string contains a valid decimal representation.


In PHP arrays aren't even arrays, they're ordered hash-tables.