How to solve the problem of array merging in PHP

Source: Internet
Author: User
array(3) {  [0] => array(2) {    ["path"] => string(3) "111"    ["title"] => string(35) "问题1"  }  [1] => array(2) {    ["path"] => string(3) "222"    ["title"] => string(35) "问题1"  }  [2] => array(2) {    ["path"] => string(4) "5555"    ["title"] => string(12) "问题2"  }}

How to make him into this format

array(2) {  [0] => array(3) {    ["title"] => string(35) "问题1"    ["path"] => array(2) {      [0]=> string(4) "111"      [1] => string(4) "222"    }  }  [1] => &array(3) {    ["title"] => string(12) "问题2"    ["id"] => string(1) "2"    ["path"] => array(1) {      [0] => string(4) "5555"    }  }}

is the title of the same merge, path consists of an array, and so on

Reply content:

array(3) {  [0] => array(2) {    ["path"] => string(3) "111"    ["title"] => string(35) "问题1"  }  [1] => array(2) {    ["path"] => string(3) "222"    ["title"] => string(35) "问题1"  }  [2] => array(2) {    ["path"] => string(4) "5555"    ["title"] => string(12) "问题2"  }}

How to make him into this format

array(2) {  [0] => array(3) {    ["title"] => string(35) "问题1"    ["path"] => array(2) {      [0]=> string(4) "111"      [1] => string(4) "222"    }  }  [1] => &array(3) {    ["title"] => string(12) "问题2"    ["id"] => string(1) "2"    ["path"] => array(1) {      [0] => string(4) "5555"    }  }}

is the title of the same merge, path consists of an array, and so on

Array_merge

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