note 52909 deleted from function.in-array by danbrown

From: Date: Mon, 08 Jun 2009 21:45:50 +0000
Subject: note 52909 deleted from function.in-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156521@lists.php.net to get a copy of this message
Note Submitter: greg at serberus dot co dot uk ---- Further to my previous post this may prove to be more efficient by eliminating the need for array_flip() on each iteration. $distinct_words = array(); foreach ($article as $word) { if (!isset($distinct_words[$word])) $distinct_words[$word] = count($distinct_words); } $distinct_words = array_flip($distinct_words);

« previous php.notes (#156521) next »