且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP从多维数组中提取值而没有循环

更新时间:2023-02-26 09:07:25

确定要查找 array_column 函数.

$newArray = array_column($originalArray,'0');

正如PHP手册中所述,使用此功能,您可以从数组数组中提取所需的唯一信息.通常与关联数组一起使用,但是您可以使用数字作为参数,并且也可以使用.

As said in PHP Manual, with this function you can extract, from an array of arrays, the only information you need. It is normally used with Associative arrays, but you can use a number as parameter and it will work as well.