PHP recursive statistics of the number of multiple-digit groups count ($ array, 1)

Source: Internet
Author: User

BelowProgramThe running result is ()

$ Numb = array (Array (10, 15, 30), array (10, 15, 30), array (10, 15, 30); echo count ($ numb, 1 );

A.3
B .12
C.6
D.9

Answer: B

If the mode in the count function is set to count_recursive (OR 1), the number of elements in the array in the multi-dimensional array (that is, the 12 in your result) is calculated recursively ). If the mode is not set, the default value is 0. Multi-dimensional arrays (arrays in arrays) are not detected (result 3 ).

First, traverse the array outside to get two elements ("color1", "color2", "color3") 3
Traverse the Array ("color1", "color2", "color3") to get 9 Elements
The result is 3 + 9 = 12.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.