How to get the number of elements in an array using PHP ?

We have two functions to get the number of elements in an array ie count() and sizeof()
Syntax : count ($array) and sizeof($array)

count()
<?php

$a[0] = 15;
$a[1] = 12;
$a[2] = 50;
$a[3] = 41;
$a[4] = 42;

echo $result = count($a);

?>

OUTPUT: 4