[PHP] Get Number of Items in Array

We can check number of items or the length of PHP array in two ways. PHP functions are below:

  • sizeof()
  • count()

Both functions count the number of element in an array.

For example.

$myArray = array("green", "yellow", "blue");
$size = sizeof($myArray);
echo $size;
Scroll to Top