php array length
snippet in php

php array length

user5728

count($myArray);

php length of array

user3591

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

php array lenght

user2504

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

for ($i=0, $len=count($

user8676


<?php
$str = 'abcdef';
echo strlen($str); // 6

$str = ' ab cd ';
echo strlen($str); // 7
?>

array length javascript

user2338

var arr = [10,20,30,40,50]; //An Array is defined with 5 instances

var len= arr.length;  //Now arr.length returns 5.Basically, len=5.
console.log(len); //gives 5
console.log(arr.length); //also gives 5

get array length using php

user2805

// 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