Posted By

paramah on 03/22/10


Tagged

php textmate array merge


Versions (?)

Merge a group of arrays


 / Published in: Other
 

  1. /**
  2. * Merge a group of arrays
  3. *
  4. * @param array First array
  5. * @param array Second array
  6. * @param array Third array
  7. * @param array Etc...
  8. * @return array All array parameters merged into one
  9. */
  10. function amerge()
  11. {
  12. $r = array();
  13. foreach(func_get_args()as $a)
  14. {
  15. if (!is_array($a))
  16. {
  17. $a = array($a);
  18. }
  19. $r = array_merge($r, $a);
  20. }
  21. return $r;
  22. }

Report this snippet  

You need to login to post a comment.