$cars |
An array is a unique variable that can store multiple values under one name, and you can access these values using an index number or key.
In PHP, there are three types of arrays:
In this tutorial, you will learn how to work with arrays, including:
Array items can be of any data type.
The most common types are strings and numbers (int, float), but array items can also include objects, functions, or even other arrays.
You can have various data types within the same array.
Array items with four different data types:
$myArr |
The true power of PHP arrays lies in the built-in array functions, such as the count() function, which is used to count array items.
How many items are present in the $cars array
$cars |