RE: Array indices

From: Date: Wed, 24 Apr 2002 09:12:50 +0000
Subject: RE: Array indices
Groups: php.general 
Request: Send a blank email to php-general+get-94335@lists.php.net to get a copy of this message
Why not just... Foreach (array_diff($array1, $array2) as $value) { $newarray[] = $value; } or am I missing something? Tim Ward Internet Chess www.chessish.com <http://www.chessish.com> ---------- From: esivertsen [SMTP:esivertsen@atmel.com] Sent: 23 April 2002 13:09 To: php-general Subject: Array indices Hi all, I have a question regarding array indices: At a certain point in code, I run array_diff() on two arrays to produce a reduced version of one of the argument arrays. Problem is, I dont want the key-value associations to be preserved. I need that the returned array has new (integer, not string) indices in numerical order from 0...N without holes. Does anybody know how to do this? I have looked at different sort functions etc, but I'd rather not do a sort to the array. The code is for random selection with reduction of the sample set (i.e. with withdrawal). All the best, Eivind

« previous php.general (#94335) next »