Home > Backend Development > PHP Tutorial > PHP counts the number of array elements, the number of PHP arrays_PHP tutorial

PHP counts the number of array elements, the number of PHP arrays_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:47:57
Original
1067 people have browsed it

php counts the number of array elements, the number of php arrays

count(): counts the number of elements in the array;

sizeof(): It has the same purpose as count(). Both functions can return the number of array elements. You can get the number of elements in a regular scalar variable. If the array passed to this function is an empty array, or an array that has not been passed For the set variable, the number of array elements returned is 0;

array_count_value(): counts the number of times each specific value appears in the array $array;

such as:

$array=array(4,5,1,2,3,1,2,1);

$ac=array_count_value($array);

will create a Named $ac array, the array includes:

                          4 1

5 5 1

1 3

2 2

3 1


Article source address: http://www .cnblogs.com/taletao/archive/2012/04/26/2471338. html





http://www.bkjia.com/PHPjc/1025225.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/1025225.htmlTechArticlephp counts the number of array elements, php array count count(): counts the number of elements in the array ; sizeof(): has the same purpose as count(). Both functions can return the number of array elements...
Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template