PHP Multidimensional Array Length
If you are assuming the subarrays are all the same length then:
$count = count($stdnt[0]);
If you don't know the keys:
$count = count(reset($stdnt));
To get an array with a separate count of each of the subarrays:
$counts = array_map('count', $stdnt);
please use sizeof function or count function with recursive
e.g echo (sizeof($stdnt,1) - sizeof($stdnt)) ; // this will output you 9 as you want .
first sizeof($stdntt,1) ; // will output you 13 . count of entire array and 1 mean recursive .
The other way to count internal array lengths is to iterate through the array using foreach
loop.
<?php
$stdnt = array(
array("Arafat", 12210261, 2.91),
array("Rafat", 12210262, 2.92),
array("Marlin", 12210263, 2.93),
array("Aziz", 12210264, 2.94),
);
foreach($stdnt as $s)
{
echo "<br>".count($s);
}
?>