Get the App
SLTechnology News&Howtos  ›  Development  › 

How many array elements can php query?

Shulou Source: shulou.com Published: 2022-06-01 03:03:54 10月05日 Update

This article mainly explains the "php can query how many array elements", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "php can query how many array elements" bar!

In PHP, you can use the count () function to query how many elements are in the array. The function returns the number of array elements with the syntax "count (array, mode)"; the second parameter defaults to 0, which means that the elements in the multi-dimensional array are not calculated; if set to 1, the multi-dimensional array elements are calculated recursively.

This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer.

Php queries how many elements there are in the array

You can query how many elements are in the array.

The count () function returns the number of elements in the array.

Grammar

Count (array,mode)

Array is required. Specifies the array to be counted.

Mode is optional. Specifies the mode of the function. Possible values:

0-default. All elements in the multidimensional array are not evaluated.

1-Recursively calculates the number of elements in the array (calculates all elements in the multidimensional array).

Return value: returns the number of elements in the array.

Examples are as follows:

The output is 3.

Thank you for reading, the above is the content of "how many array elements can be queried by php". After the study of this article, I believe you have a deeper understanding of the question of how many array elements php can query, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Arrays elements queries functions numbers multidimensions learning content results syntax recursion parameters that is ideas situations articles more patterns environments computers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi NVidia Shulou Tech Info MariaDB