Ads by ProfitSence
Close

Find PHP Size of array , length of array , count function

Last Updated on Wednesday 5th Oct 2022
  • Arrays are labeled as a collection of values that are related.
  • They can be data submitted in a specific form like students' names in a class etc...
  • An array has elements in the form of keys and values.

Find Length of Array

  • PHP allows you to count the length of an array with the help of the count() function.
			
					<html>

<head>
    <title>This is my PHP Script</title>
</head>

<body>
    <?php Add Here ?>
</body>

</html>
<html>

<head>
    <title>This is my PHP Script</title>
</head>

</html>

			
	

PHP Count() Function

			
					<?php
$names = array(
    "Adam",
    "Alice",
    "Sam",
    "Ben",
    "Tom",
    "Oliver",
    "Paige",
    "Lana"
);

echo 'The Count names array :', count($names);

?>

			
	
			
					// The Count names array :8