pluck.php
<?php
/**
* @param $arr
* @param $key
* @return array
*/
public static function pluck($arr, $key)
{
return array_map(function ($item) use ($key) {
if (is_object($item)) {
if (isset($item->$key)) {
return $item->$key;
}
}
elseif (is_array($item)) {
if (isset($item[$key])) {
return $item[$key];
}
}
}, $arr);
}