Answers for "php array_count"

PHP
3

php count array elements with specific key

$cnt = count(array_filter($array,function($element) {
  return $element['your_key']=='foo';
}));
Posted by: Guest on July-13-2020
1

count an array in php

<?php
 $vegetables = ["Cabbage", "Carrot", "Lettuce"];
 $arrayLength = count($vegetables);
 echo $arrayLength; //returns 3
?>
Posted by: Guest on June-20-2021
0

get count array php

$days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
 
// Printing array size
echo count($days);
echo "<br>";
echo sizeof($days);
Posted by: Guest on October-23-2021

Browse Popular Code Answers by Language