I have an开发者_如何学编程 array like this...
Array
(
[0] => Array
(
[id] => 10651
[userid] => 079eb9f4b9eb573f6aec93ce97ed1e7f
)
[1] => Array
(
[id] => 74315
[userid] => 1283612836
)
[2] => Array
(
[id] => 74315
[userid] => asydk12893489123
)
)
is there a php function that returns me an array of values of the key userid
if I make a call like this...
func($arr_name, $key_name);
Regards
No, but you can make one.
function getFromKey($array, $keyName) {
$return = array();
foreach ($array as $value) {
if (isset($value[$keyName]))
$return[] = $value[$keyName];
}
return $return;
}
精彩评论