PHP Arry_push Method Usage Note

Source: Internet
Author: User

When adding elements to a child element in an array using the Arry_push method, it should be noted that the following occurs when using a predefined element push:

Array_push ($bladeList[0][' Children '],$nodeList), the results are different!
            $bladeList=Array(); $nodeList=Array(); Array_push($nodeList,Array(                "Text" = ' Test ', "status" = ' 1 ', "checked" and "="false, "leaf" =true            )); Array_push($bladeList,Array(            "Text" = ' testrt ', ' status ' = ' 1 ', ' expanded ' =true, "Checked" =false, "Children" =$nodeList            )); Array_push($bladeList[0] [' Children '],$nodeList);

The output results are as follows:
checked false Children    checkedfalse  expandedtrue  text: "3"
//"Children" =$nodeList Get the following structure
0: checked:false leaf:true status:0 text: "108"
//
Array_push($bladeList[0][' Children '],$nodeList); Get the following structure
1: 0: checked:false leaf:true status:0 Text: "108"

expanded: true
text: "10.0"

Array_push ($bladeList[0][' Children '],$nodeList);

PHP Arry_push Method Usage Note

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.