dq5studios / entity_column

array_column() 的替代品,支持具有属性的对象。

v1.0.0 2023-05-25 04:08 UTC

This package is auto-updated.

Last update: 2024-09-25 07:21:58 UTC


README

Build Status codecov shepherd Packagist Version PHP from Packagist Packagist

entity_column

array_column() 的替代品,支持具有属性的对象。

使用方法

use function DQ5Studios\EntityColumn\entity_column;

function entity_column(array $array, int|string $column_key, int|string|null $index_key = null): array

参数

array

一个多维数组或从其中提取值列的对象数组。

column_key

要返回的值列。

index_key

用作返回数组索引/键的列。

返回值

返回一个表示输入数组中单个列的值数组的数组。