Posted By

michaelfox on 04/09/09


Tagged

php textmate array jquery utility extend


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

straps


jQuery style extend in PHP


 / Published in: PHP
 

  1. /**
  2.  * jquery style extend, merges arrays (without errors if the passed values are not arrays)
  3.  *
  4.  * @return array $extended
  5.  **/
  6. function extend() {
  7. $args = func_get_args();
  8. $extended = array();
  9. if(is_array($args) && count($args)) {
  10. foreach($args as $array) {
  11. if(is_array($array)) {
  12. $extended = array_merge($extended, $array);
  13. }
  14. }
  15. }
  16. return $extended;
  17. }
  18.  

Report this snippet  

You need to login to post a comment.