Posted By

collin on 09/26/06


Tagged

php map


Versions (?)

map_attr


 / Published in: PHP
 

Map an array of objects to a named attribute on those objects.

  1. function map_attr($attr, $array)
  2. {
  3. $result = array();
  4. foreach($array as $obj)
  5. {
  6. $result[] = $obj->$attr;
  7. }
  8. return $result;
  9. }

Report this snippet  

You need to login to post a comment.