🐘 PHP Beginner

What is a PHP array?

Answer

A PHP array is a versatile ordered map that can store multiple values of any type under named keys or auto-incremented integer indices. PHP supports three types: Indexed arrays with numeric keys ($fruits = ["apple", "banana", "cherry"]), Associative arrays with string keys ($person = ["name" => "Alice", "age" => 25]), and Multidimensional arrays (arrays containing other arrays). PHP arrays are dynamic — they can grow or shrink at runtime, and a single array can mix integer and string keys. Unlike many languages, PHP arrays are actually ordered hash maps, so they maintain insertion order.