calculate array length in php code example Example: calculate array length in php $a[0] = 1; $a[1] = 3; $a[2] = 5; var_dump(count($a));