Multi-dimensional array-how to convert a four-dimensional array into a two-dimensional array in php

Source: Internet
Author: User
SegmentFault (www. sf. gg) is a leading developer technology community in China. We hope to provide programmers with a pure and high-quality technology exchange platform to learn, communicate and grow with developers and create an era for developers!

Reply content:

It is probably the meaning of a pure-handed taxi. It is best to put the data out and test it:

Function array_unzip_rescursive ($ arr) {$ res = array (); if (array_key_exists ('name', $ arr) $ res [] = $ arr; else foreach ($ arr as $ item) $ res = array_merge ($ res, array_unzip_rescursive ($ item); return $ res ;}

Foreach ($ arr ['1'] as $ row) {$ res [] = $ row ['0'];}

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.