note 114839 added to function.array-diff-assoc

From: Date: Sun, 13 Apr 2014 04:01:03 +0000
Subject: note 114839 added to function.array-diff-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-199254@lists.php.net to get a copy of this message
Works more like the original function: <?php function array_diff_assoc_recursive ( ) { $args = func_get_args ( ); $diff = array ( ); foreach ( array_shift ( $args ) as $key => $val ) { for ( $i = 0, $j = 0, $tmp = array ( $val ) , $count = count ( $args ); $i < $count; $i++ ) if ( is_array ( $val ) ) if ( !isset ( $args[$i][$key] ) || !is_array ( $args[$i][$key] ) || empty( $args[$i][$key] ) ) $j++; else $tmp[] = $args[$i][$key]; elseif ( ! array_key_exists ( $key, $args[$i] ) || $args[$i][$key] !== $val ) $j++; if ( is_array ( $val ) ) { $tmp = call_user_func_array ( __FUNCTION__, $tmp ); if ( ! empty ( $tmp ) ) $diff[$key] = $tmp; elseif ( $j == $count ) $diff[$key] = $val; } elseif ( $j == $count && $count ) $diff[$key] = $val; } return $diff; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 178.70.203.25 ---- Manual Page -- http://php.net/manual/en/function.array-diff-assoc.php Edit -- https://master.php.net/note/edit/114839 Del: integrated -- https://master.php.net/note/delete/114839/integrated Del: useless -- https://master.php.net/note/delete/114839/useless Del: bad code -- https://master.php.net/note/delete/114839/bad+code Del: spam -- https://master.php.net/note/delete/114839/spam Del: non-english -- https://master.php.net/note/delete/114839/non-english Del: in docs -- https://master.php.net/note/delete/114839/in+docs Del: other reasons-- https://master.php.net/note/delete/114839 Reject -- https://master.php.net/note/reject/114839 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199254) next »