Turn a simple two-dimensional array into a one-dimensional array, a two-dimensional array and a two-dimensional array_PHP tutorial

WBOY
Release: 2016-07-13 09:46:17
Original
975 people have browsed it

Convert a simple two-dimensional array into a one-dimensional array, a two-dimensional array

In work, we often need to convert a two-dimensional array into a one-dimensional array. Then we need to loop it out. In fact, sometimes we can use some tricks to achieve it with the help of PHP's built-in functions, but what I'm talking about is just a simple two-dimensional array $arr= array('name'=>array(' a'=>'abc','b'=>'bcd','c'=>'cde')); If we use array_pop(), we can get a one-dimensional array, array_pop() Originally deletes and returns the last element of the array.

So we can change the $arr of the appeal into array('a'=>'abc','b'=>'bcd','c'=>'cde'), so that The two-dimensional array becomes a one-dimensional array, but only if the two-dimensional array is a one-dimensional array. If there are multiple one-dimensional arrays, the last array will be returned.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1034504.htmlTechArticleConvert a simple two-dimensional array into a one-dimensional array. In work, we often need to convert a two-dimensional array into a one-dimensional array. A two-dimensional array becomes a one-dimensional array. Then I need to cycle it out. In fact, sometimes I...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template