Convert an easy two-dimensional array into a one-dimensional array

Source: Internet
Author: User
To convert a simple two-dimensional array into a one-dimensional array, we often need to convert the two-dimensional array into a one-dimensional array. So we need to take it out cyclically. In fact, sometimes we can use some tips to implement it using php's built-in functions, but what I'm talking about is a simple two-dimensional number array $ arrarray (name & gt; array (a & gt; abc, B & gt; bcd, c & gt; cde); if we use array _ to convert a simple two-dimensional array into a one-dimensional array

In our work, we often need to convert a two-dimensional array into a one-dimensional array. So we need to take it out cyclically. In fact, sometimes we can use some tips to implement it using php built-in functions, but what I'm talking about is a simple two-dimensional number array $ arr = array ('name' => array ('a' => 'ABC', 'B' => 'bcd ', 'C' => 'Cde'); if we use array_pop (), we can get the one-dimensional array. array_pop () is the last element to delete and return the array.

So we can change the $ arr of the appeal to array ('a' => 'ABC', 'B' => 'bcd', 'C' => 'Cde '), in this way, the two-dimensional array is converted into a one-dimensional array, but only one-dimensional array is contained in the two-dimensional array. if multiple one-dimensional arrays exist, the last array is returned.

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.