RE: [PHP-DB] array_diff usage

From: Date: Mon, 02 Apr 2001 13:41:13 +0000
Subject: RE: [PHP-DB] array_diff usage
Groups: php.db 
Request: Send a blank email to php-db+get-8136@lists.php.net to get a copy of this message
> -----Original Message----- > From: Martin Skjoldebrand [mailto:chimbis@skjoldebrand.org] > Sent: Saturday, March 31, 2001 10:52 PM > To: php-db@lists.php.net > Subject: [PHP-DB] array_diff usage > > > I'm daft. I don't understand the PHP Manual. > > I have two arrays: > Open[0] contains 1 2 3 4 5 > Closed[0] contains 1 2 > > Now: > $test = array_diff($Open, $Closed); Given the setup you've described, I think you might actually want $test = array_diff($Open[0], $Closed[0]); > $lines = count($test); > print $lines; > > Gives me: 1 > I thought it should be 3. Seems appropriate, given the information you've provided. $Open and $Closed each have only one element (0). > While: > for ($counter =0; $counter <= $lines -1; $counter++) > { > print $test[0]; > } > > gives me "5". This, on the other hand, makes me suspect that the arrays themselves don't actually contain what you think they do. How are you assigning the values you described at the top of your message? --- Mark Roedel (roedelm@letu.edu) || "There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full." LeTourneau University || -- Henry Kissinger

« previous php.db (#8136) next »