PHP 7 Script to Count All Array Elements Using count() and sizeof() Method Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments

 

 

<?php  
    $ele = array("Ryan", "Ahana", "Ritvik", "Amaya");  
    $no_of_ele = count($ele);  
    echo "Number of elements present in the array: ".$no_of_ele;  
?>

 

 

<?php  
    $ele = array(14, 89, 26, 90, 36, 48, 67, 75);  
    $no_of_ele = sizeof($ele);  
    echo " Number of elements present in the array: ".$no_of_ele;  
?>

Leave a Reply