count array php
snippet in php

array_count_values php

user889

<?php
$a=array("A","Cat","Dog","A","Dog");
print_r(array_count_values($a));
?>
 

php array length

user4366

count($myArray);

php length of array

user7957

<?php
	$arr = ["one", "two", "three", "four"];
	echo count($arr);
  ?>

php array lenght

user9822

<?php
$cars=array("Volvo","BMW","Toyota");
echo count($cars);
?>

get array length using php

user9080

// using count() we can get proper length of the array
$names = array("Ankur","Raj","Ram","Suresh");
// pass array into count() as parameter it will return array length
echo count($names);

// output : 4

count array php

user572

$cars=array("Volvo","BMW","Toyota");
echo count($cars);
//returns 3