note 48924 modified in function.array-diff-assoc by danbrown

From: Date: Sat, 14 Mar 2009 14:52:34 +0000
Subject: note 48924 modified in function.array-diff-assoc by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151902@lists.php.net to get a copy of this message
Hi all, For php versions < 4.3... <?php /** * array_diff_assoc for version < 4.3 **/ if (!function_exists('array_diff_assoc')) { function array_diff_assoc($a1, $a2) { foreach($a1 as $key => $value) { if(isset($a2[$key])) { if((string) $value !== (string) $a2[$key]) { $r[$key] = $value; } }else { $r[$key] = $value; } } return $r ; } } ?> --was-- Hi all, For php versions < 4.3... <?php /** * array_diff_assoc for version < 4.3 **/ if (!function_exists('array_diff_assoc')) { function array_diff_assoc($a1, $a2) { foreach($a1 as $key => $value) { if(isset($a2[$key])) { if((string) $value !== (string) $a2[$key]) { $r[$key] = $value; } }else { $r[$key] = $value; } } return $r ; } } Hope there's no bug, cheers ?> http://php.net/manual/en/function.array-diff-assoc.php

« previous php.notes (#151902) next »