Re: problem with array diff, need to reindex array according to key

From: Date: Tue, 26 Apr 2005 15:31:28 +0000
Subject: Re: problem with array diff, need to reindex array according to key
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213932@lists.php.net to get a copy of this message
Angelo Zanetti wrote:
HI all, I am using the array_diff function. The problem im having is the array that gets returned. Well here's an example: this is where i assign the values to two different arrays $a[]="0"; $a[]="1"; $a[]="2"; $a[]="3"; $b[]="1"; $b[]="4"; $b[]="0"; $diff = array_diff_assoc($a, $b);
/* Get the diff of the arrays, but re-index to 0 */ $diff = array_values(array_diff_assoc($a, $b));

« previous php.general (#213932) next »