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, 2109🔥, 0💬
Popular Posts:
What Azure AD App Registration Manifest? Azure AD App Registration Manifest is JSON file that contai...
How to use the "@(...)" expression in Azure API Policy? The "@(...)" expression in Azure API Policy ...
What validation keywords I can use in JSON Schema to specifically validate JSON Array values? The cu...
Where to get the detailed description of the JSON.stringify() Function in JavaScript? Here is the de...
What is test testing area for? The testing area is provided to allow visitors to post testing commen...