-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
The Art of Modern PHP 8
By :
Now that we have looked at the simple scalar types, we should look at the single most utilized compound type in PHP – the array – and its close relation, iterables.
Arrays in PHP are hugely powerful and useful. You can use it to pass a handful of values around, or you can let it grow to tremendous sizes and eat all your system's RAM if you so choose.
Have a look at the official docs for arrays:
PHP: Arrays - Manual
https://www.php.net/manual/en/language.types.array.php
What the docs say, in more words than me, is that arrays are the single tool that ticks a load of data structure boxes. An array consists of keys and associated values. The keys can be int or string. If they are not specified, then they are int starting at 0.
There are a huge number of built-in functions that assist with efficiently processing arrays. You should always try to use the built-in functions instead of creating your own, so try to learn the...