Home > php教程 > php手册 > body text

Multidimensional array to one-dimensional array

WBOY
Release: 2016-11-19 13:05:23
Original
1256 people have browsed it

Code to facilitate some data processing
​​<br> //Multiple dimensions become one dimension<br> function arr_foreach ($arr)<br> {<br>         static $tmp=array(); <br> If (!is_array ($arr))<br>           {<br>                                                                                                                                                                                                   return  false;       }<br> foreach ($arr as $val)<br>           {<br>             if (is_array ($val))<br>                                      {<br>                arr_foreach ($val);<br>          }<br>          else<br>                                       {<br>                $tmp[]=$val;<br>          }<br>       }<br>                                                                                                                                       return }<br> <br>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template