note 12343 deleted from function.array-diff by irc-html

From: Date: Sat, 19 Jan 2002 20:58:20 +0000
Subject: note 12343 deleted from function.array-diff by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25447@lists.php.net to get a copy of this message
SHEESH! Ok after about an hour and a half of looking at print_r() output and rewriting my own code, I figured it out - numeric indexes are "keys" too... meaning: ---CODE--- $blah = array("eat","my","shorts"); $fooey = array("my","shorts","eat","you"); $yay = array_diff($fooey,$blah); print_r($yay); ---OUTPUT--- array [ [3] => "you" ] This causes for() loops to produce unexpected results: for ($i=0; $i!=count($yay); $i++) { // do something with $yay[$i]; } This stinks IMO - even though in much of PHP's functionality, the cross-functionality between numeric and associative arrays is all good, this is kind of silly... maybe a third option is in order, NUM_INDEX or something?

« previous php.notes (#25447) next »