In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you how php queries the array how many key value pairs of relevant knowledge, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you have something to learn after reading this article, let's take a look at it.
In php, you can use the count () or sizeof () functions to query the number of key value pairs in an array, both of which can get the number of key-value pairs (elements) in the array; the syntax "count ($array, 1)" or "sizeof ($array, 1)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
How does php query the number of key value pairs in an array
To query the number of key value pairs in an array is to query how many elements there are in the array, that is, the length of the array.
In PHP, two functions, count () and sizeof (), are provided to get the array length (one or more dimensions are fine, just set the second parameter to 1).
In fact, the sizeof () function is an alias for the count () function, so the usage of the two functions is the same.
Count ($array, $mode) sizeof ($array, $mode)
The parameters are described as follows:
$array: the array or object to be counted
$mode: optional parameter, which can be omitted.
If you omit the $mode parameter, or set it to COUNT_NORMAL or the 0account count () function will not detect multidimensional arrays
If $mode is set to COUNT_RECURSIVE or the 1 count () function will recursively count the number of elements in the array, it is especially useful for counting the number of elements in a multi-dimensional array.
Example:
One-dimensional array:
Two-dimensional array:
Three-dimensional array
These are all the contents of the article "how php queries arrays of key value pairs". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.