-
- $users = array ("qdv.cn", "haotu.net", "sharejs.com", "google.com");
- print count($users)-1;
Copy code Example 2, usage of php function count to get the length of an array.
Example 2, the count function is used to obtain the length of the array
- $array = array("PHP", "Perl", "Java");
- print_r("Size 1: ".count($array)."n");
- $array = array();
- print_r("Size 2: ".count($array)."n");
- ?>
Copy code
Output result:
Size 1: 3
Size 2: 0
|