Re: Word List
| From: | Lars Torben Wilson | Date: | Tue, 31 Oct 2000 21:42:30 +0000 |
| Subject: | Re: Word List | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23016@lists.php.net to get a copy of this message | ||
TMC writes:
> Hi,
> I'm currently developing a website using PHP and I need either a Prog that
> can format Word lists or a finished Word List containing all words with up
> to 7 letters.
>
> Any sugestions?
In what language? Try /usr/dict. If you have it installed, you should
have a huge list. Here's a short script to pull them out:
<?php
error_reporting(E_ALL);
$maxwordlen = 7;
$all_words = file('/usr/dict/words');
while (list(, $word) = each($all_words)) {
/* Add one to the length to include the newline. */
if (strlen($word) <= $maxwordlen + 1) {
echo $word;
}
}
?>
You can modify this to do whatever you like with the words...
Is this like what you meant?
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+