The What
Syntax
array( string|integer key1 => mixed value1, string|integer key2 => mixed value2, string|integer key3 => mixed value3, )
Description
In the following video, you will learn what an array data type is in PHP as well as the syntax, including how to access individual pieces of data within the array.
Visualization can help you to understand a concept. In this video, the array is demonstrated as post office boxes and an apartment building.
-
Code example
Who needs copy/paste? Right. Writing code from scratch is fun!
Deep into the Array Data TypePro
In this video, you will go deeper into the instruction.
Understanding the KeysPro
Keys need to be either a string or an integer data type. What happens when you specify it as another data type, such as a floating point, boolean, etc.? The PHP Manual specifies how it type casts the key to the appropriate data type.
In this video, you will put the manual to the test by trying each of the data types. Let’s see what happens and then learn why.
The Internal PointerPro
In PHP, within the array data type there is a pointer. Its job is to keep track of its current element position. Functions use this pointer to traverse (move) through the elements of the array. In this video, you will learn about the pointer.