PHP Tutorial

A web server programming language.

PHP Arrays

PHP Arrays

An array stores multiple values in one single variable.

Types of Arrays in PHP:

  • Indexed arrays - Arrays with a numeric index
  • Associative arrays - Arrays with named keys
  • Multidimensional arrays - Arrays containing one or more arrays

Use the count() function to return the length (the number of elements) of an array.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics