note 5394 deleted from in_array by ronabop

From: Date: Sat, 19 Aug 2000 04:20:14 +0000
Subject: note 5394 deleted from in_array by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-2635@lists.php.net to get a copy of this message
What if the keys aren't sequential? This will work if they don't have sequential keys. <pre> function in_array($needle,$haystack) { $found=false; while(list($counter,$haystack_rec)=each($haystack)){ if($needle==$haystack_rec){ $found=true; } } return $found; } </pre>

« previous php.notes (#2635) next »