Tools, FAQ, Tutorials:
Counting the Number of Values in an Array in PHP
How To Get the Total Number of Values in an Array in PHP?
✍: FYIcenter.com
You can get the total number of values in an array by using the count() function. Here is a PHP example script:
<?php
$array = array("PHP", "Perl", "Java");
print_r("Size 1: ".count($array)."\n");
$array = array();
print_r("Size 2: ".count($array)."\n");
?>
This script will print:
Size 1: 3 Size 2: 0
Note that count() has an alias called sizeof().
⇒ Verifying If a Key Exists in an Array in PHP
⇐ PHP Built-in Functions for Arrays
2017-01-29, ∼3054🔥, 0💬
Popular Posts:
How To Change Text Fonts for Some Parts of a Paragraph? If you want to change text fonts or colors f...
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...
Can Multiple Paragraphs Be Included in a List Item? Yes. You can include multiple paragraphs in a si...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...