Home > Backend Development > PHP Tutorial > php多维数组合并成一个数组

php多维数组合并成一个数组

WBOY
Release: 2016-06-23 13:46:33
Original
1744 people have browsed it

Array ( [0] => Array ( [id] => 1 ) [1] => Array ( [id] => 2 ) ) 


回复讨论(解决方案)

多维数组也是一个数组
你想合并成什么样式的?

多维数组也是一个数组
你想合并成什么样式的?


刚才想点引用的,结果点成了丢转了。
我的意思是想把多维数组合并成一维数组。我好根据这个一维数组作为条件查找数据库

由于你没有给出你需要的格式,所以只能举一例

$a = Array(  Array( 'id' => 1 ),  Array( 'id' => 2 ));$a = array_map('current', $a);print_r($a); 
Copy after login
Array(    [0] => 1    [1] => 2)
Copy after login

$a = Array(  Array( 'id' => 1 ),  Array( 'id' => 2 ));$ar = array();foreach($a as $v) $ar[] = $v['id'];print_r($ar);
Copy after login

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