Posted By

razel on 02/06/08


Tagged

php array fallback


Versions (?)

array_intersect_key() for php4


 / Published in: PHP
 

Fallback Function for versions earlier then php5

  1. if (!function_exists('array_intersect_key'))
  2. {
  3. function array_intersect_key ($isec, $arr2)
  4. {
  5. $argc = func_num_args();
  6.  
  7. for ($i = 1; !empty($isec) && $i < $argc; $i++)
  8. {
  9. $arr = func_get_arg($i);
  10.  
  11. foreach ($isec as $k => $v)
  12. if (!isset($arr[$k]))
  13. unset($isec[$k]);
  14. }
  15.  
  16. return $isec;
  17. }
  18. }

Report this snippet  

You need to login to post a comment.