1// using count() we can get proper length of the array
2$names = array("Ankur","Raj","Ram","Suresh");
3// pass array into count() as parameter it will return array length
4echo count($names);
5
6// output : 4
1<?php
2 //use count($var) ->
3$a[0] = 1;
4$a[1] = 3;
5$a[2] = 5;
6var_dump(count($a));
1<?php
2 $names = array("Ankur","Raj","Ram","Suresh");
3 echo count($names);
4 $cars=array("Volvo","BMW","Toyota");
5 echo count($cars);
6// test