多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
PHP提取多维数组指定一列的方法大全 array_column($array, '元素'); foreach() array_walk() array_map() ``` <?php $user = array( '0' => array('id' => 100, 'username' => 'a1'), '1' => array('id' => 101, 'username' => 'a2'), '2' => array('id' => 102, 'username' => 'a3'), '3' => array('id' => 103, 'username' => 'a4'), '4' => array('id' => 104, 'username' => 'a5'), ); $username1 = array_column($user, 'username'); print_r($username1); echo '<br>'; $username2 = array(); array_walk($user, function($value, $key) use (&$username2){ $username2[] = $value['username']; }); print_r($username2); echo '<br>'; $username3 = array(); array_map(function($value) use (&$username3){ $username3[] = $value['username']; }, $user); print_r($username3); echo '<br>'; $username4 = array(); foreach ($user as $value) { $username4[] = $value['username']; } print_r($username4); echo '<br>'; $username5 = array_map('reset', $user); $username6 = array_map('end', $user); print_r($username5); echo '<br>'; print_r($username6); echo '<br>'; ``` PHP提取多维数组指定一列的方法大全:https://www.cnblogs.com/isykw/p/6703500.html 111