Posted By

razel on 02/06/08


Tagged

php array fallback


Versions (?)

array_diff_key() for PHP4


 / Published in: PHP
 

Fallback Function for versions earlier then php5

  1. if (!function_exists('array_diff_key'))
  2. {
  3. function array_diff_key()
  4. {
  5. $arrs = func_get_args();
  6. $result = array_shift($arrs);
  7. foreach ($arrs as $array) {
  8. foreach ($result as $key => $v) {
  9. if (array_key_exists($key, $array)) {
  10. unset($result[$key]);
  11. }
  12. }
  13. }
  14. return $result;
  15. }
  16. }

Report this snippet  

You need to login to post a comment.