How to split a part from a group as a new array-php Tutorial

Source: Internet
Author: User
How to split a part from a number Group as a new array. Array (& nbsp; [totalcount] & gt; 2 & nbsp; [errorcount] & gt; 0 & nbsp; [orderlist] & gt; Array & nbsp; (& nbsp; [order] & gt; Array & nbsp how to split a part from a number Group as a new Array.
Array
(
[Totalcount] => 2
[Errorcount] => 0
[Orderlist] => Array
(
[Order] => Array
(
[0] => Array
(
[Orderamount] = & gt; 130.0
[Ordercode] = & gt; 11111009 FTHT
[Ordercreatetime] => 2011-11-11 20:44:32
[Orderdeliveryy] => 0.0
[Orderid] = & gt; 21919876
[Orderneedinvoice] => 0
[Orderstatus] => ORDER_OUT_OF_WH
[Productamount] = & gt; 130.0
)

[1] => Array
(
[Orderamount] = & gt; 200.0
[Ordercode] = & gt; 3311009 FTHT
[Ordercreatetime] => 20:44:32
[Orderdeliveryy] => 0.0
[Orderid] = & gt; 21919876
[Orderneedinvoice] => 0
[Orderstatus] => ORDER_OUT_OF_dfd
[Productamount] = & gt; 130.0
)

)

)

[Encoding] => UTF-8
)




I need the part in [order] to propose this array as a new array. how can this problem be solved.

------ Solution --------------------
$ New_arr = $ all_arr ['order'];
------ Solution --------------------
Suppose $ arr is your original array.
$ NewArr = $ arr ['order'];
------ Solution --------------------
The two upstairs did not see the array structure clearly:
PHP code
// Modify the required array $ newArr = $ arr ['orderlist'] ['order']; // If you need to merge the modified result into the original array: $ arr ['orderlist'] ['order'] = $ newArr;

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.