A Closer Look Into Php Arrays

PHP is one unique language where the array data type has been highly generalized to suit a very broad set of use cases. For example, in PHP you can use an array to create both ordered lists as well as dicts (key/value pairs or maps) with a single data type. A PHP array isn’t an array in the traditional sense, but in fact it’s actually implemented as an ordered hashmap. There are good reasons for this. One of those reasons is that arrays traditionally do not allow you to mix types. They also don’t normally provide a simple means of random access such as mapping a key to it’s value. At least not in the sense that we’re used to doing in PHP. So I’m going to share with you some of the underlying details of how the PHP array data type works, why it works the way that it does, how it’s different from other languages, and what behaviors the PHP array has that you may not be fully aware of… (article continues via the link below)

Full Article: A Closer Look Into PHP Arrays: What You Don’t See (sheriframadan.com)

Written on January 20, 2013