/ Published in: PHP
Map an array of objects to a named attribute on those objects.
Expand |
Embed | Plain Text
function map_attr($attr, $array) { foreach($array as $obj) { $result[] = $obj->$attr; } return $result; }
You need to login to post a comment.
