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, 2333🔥, 0💬
Popular Posts:
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How to use the JSON to XML Conversion Tool at freeformatter.com? If you want to try the JSON to XML ...
How to use the "rewrite-uri" Policy Statement for an Azure API service operation? The "rewrite-uri" ...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...