note 52909 added to function.in-array
| From: | greg at serberus dot co dot uk | Date: | Tue, 17 May 2005 12:49:18 +0000 |
| Subject: | note 52909 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89533@lists.php.net to get a copy of this message | ||
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);
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52909
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52909&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52909&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52909&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52909&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52909&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52909&report=yes
Search -- http://master.php.net/manage/user-notes.php