1.

How To Get The Total Number Of Values In An Array?

Answer»

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");
?&GT;
This script will print:
Size 1: 3
Size 2: 0
Note that count() has an alias called sizeof().

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().



Discussion

No Comment Found