Three-dimensional array, count the number of elements, ask

Source: Internet
Author: User
How to count the first record the rule_1 element has two?

Article two, the third may be different, to find out, ask, thank you


Reply to discussion (solution)

Give the result of serialize (NO)


Array (size=2)
0 =
Array (size=16)
' id ' = = String ' (length=3)
' uid ' = = String ' 1 ' (length=1)
' Shopid ' = String ' 328 ' (length=3)
' num ' = String ' 2 ' (length=1)
' Color ' = String ' 1 ' (length=1)
' Freight ' = String ' 0 ' (length=1)
' Mony ' = String ' 2 ' (length=1)
0 =
Array (size=6)
' Rule_1 ' =
Array (size=3)
...
' Piece ' = String ' 2 ' (length=1)
' goods_id ' = String ' 304 ' (length=3)
' Givenum ' = String ' 2 ' (length=1)
' Givename ' = String ' 3525 ' (length=4)
' givegoodimg ' = ' = String ' (length=0)
1 =
Array (size=6)
' Rule_1 ' =
Array (size=3)
...
' Piece ' = String ' 3 ' (length=1)
' goods_id ' = String ' 309 ' (length=3)
' Givenum ' = String ' 1 ' (length=1)
' Givename ' = String ' test09 ' (length=6)
' givegoodimg ' = String ' http://vshop.com/Uploads/Picture/2015-09-20/55fe739a50002.jpg ' (length=61)
' Spec_date ' = String ' 11+22 ' (length=5)
' goods_img ' = String ' http://vshop.com/Uploads/Picture/2015-10-09/561713942c03c.jpg ' (length=61)
' Goods_name ' = String ' test499 ' (length=7)
' Price ' = = String ' 1.00 ' (length=4)
' Goods_code ' = String ' SC23261406 ' (length=10)
' Volume ' = String ' 2 ' (length=1)
' Unit ' = = String ' 1 ' (length=1)
1 =
Array (size=15)
' id ' = = String ' 439 ' (length=3)
' uid ' = = String ' 1 ' (length=1)
' Shopid ' = String ' 319 ' (length=3)
' num ' = String ' 5 ' (length=1)
' Color ' = String ' 1 ' (length=1)
' Freight ' = String ' (length=2)
' Mony ' = "string ' (length=2)
0 =
Array (size=6)
' Rule_1 ' =
Array (size=3)
...
' Piece ' = String ' 2 ' (length=1)
' goods_id ' = "String '" (length=3)
' Givenum ' = String ' 3 ' (length=1)
' Givename ' = String ' l ' oreal hand Cream ' (length=15)
' givegoodimg ' = ' = String ' (length=0)
' Spec_date ' = String ' 1+3 ' (length=3)
' goods_img ' = String ' http://vshop.com/Uploads/Picture/2015-08-31/55e3fa7e0e5f2.jpg ' (length=61)
' Goods_name ' = String ' test02 ' (length=6)
' Price ' = = String ' 10.00 ' (length=5)
' Goods_code ' = String ' SC60023958 ' (length=10)
' Volume ' = String ' 3 ' (length=1)
' Unit ' = = String ' 1 ' (length=1)

which
First article



Array (size=3)
1 = String ' 2 ' (length=1)
2 = String ' 304 ' (length=3)
3 = String ' 2 ' (length=1)

Array (size=3)
1 = String ' 3 ' (length=1)
2 = String ' 309 ' (length=3)
3 = String ' 1 ' (length=1)

The second article Rule_1 is


Array (size=3)
1 = String ' 2 ' (length=1)
2 = String ' All ' (length=3)
3 = String ' 3 ' (length=1)

Since you like to hide your resistance, it's just that.
Observe that rule_1 belongs to the third dimension of the association key, and you get a double loop to traverse it.



For advice
Get a double loop and walk through it.
What's the whole? No data, no friends.

Loops out are troublesome, this is used in, orders, each product promotion rules are not the same, there is a two

No data How to write code?
Do I have to make some data for you?

Come on, thank you.

$nn = 0;foreach ($shop _list as $key =>& $val) {for ($i =0; $i
 
   
  
   



Big-God-class people like analog data.

Thanks, come out.

Not like to like analog data
But since you're teaching how to do it, you have to give the code that can pass the test.

Thank you ~ ~

  • 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.