array_intersect_key() for php4


/ Published in: PHP
Save to your folder(s)

Fallback Function for versions earlier then php5


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.