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, ∼2756🔥, 0💬
Popular Posts:
How To Set session.gc_divisor Properly in PHP? As you know that session.gc_divisor is the frequency ...
Where to find tutorials on EPUB file format? I want to know how to create EPUB books. Here is a larg...
What is Azure API Management Publisher Dashboard? Azure API Management Publisher Dashboard is an Azu...
How to create the Hello-3.0.epub package? I have all required files to create Hello-3.0.epub. To cre...
How To Open Standard Output as a File Handle in PHP? If you want to open the standard output as a fi...