| |
|
PHP array length or size count |
Array is very flexible and any time we can add element to array or
remove element from an array. So we must know what are the present number of
elements in an array. To know the total length or total element in an array we have to use count
command.
We will first create an array like this
$array = array ("ABC","DEF", "GHI",
"KLM");
//Now we will use the count command to know the number of elements in this
array.
print count($array);
//This will output 4 as there are four elements inside the array.
You can use sizeof function also to determine the number of values
$value= array(2,5,6,8,9);
echo "size of array = ".sizeof($value)."<br>"; // Output = 5
The above line output will be 5
We can findout the sum of the elements of an array by using array_sum() function
In ASP UBound function is used to get the size of an array
| |
| Subscribe |
|
Submit your email address and receive
article and product notifications. Your email is safe with us.
|
|
|
|
|
|