Sorry, my F**** outlook replaced '//' commentaries by 'file://' ... these
lines where for debugging, they can be deleted !!!
----- Original Message -----
From: nicolas costes <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 10, 2001 11:36 AM
Subject: Re: [PHP] Re: [PHP-DEV] Anagram Type Puzzle
> <html>
> <body>
> <?php
>
> $tab=array("a"=>26,"b"=>25,"c"=>24,"d"=>23,
> "e"=>22,"f"=>21,"g"=>20,"h"=>19,
> "i"=>18,"j"=>17,"k"=>16,"l"=>15,
> "m"=>14,"n"=>13,"o"=>12,"p"=>11,
> "q"=>10,"r"=>9,"s"=>8,"t"=>7,
> "u"=>6,"v"=>5,"w"=>4,"x"=>3,
> "y"=>2,"z"=>1);
>
>
> $fid=fopen("testfile.txt","r");
>
> $line_num=0;
> while (!feof($fid))
> {
> $line_num++;
> file://echo "ligne : $line_num\n<br>\n";
> $line = strtolower(fgets($fid,4096));
> file://echo "contenu de la ligne : $line\n<br>\n";
> $words= explode(" ",$line);
> while (list($foo,$word)=each($words))
> {
> $word_value=0;
> for ($car=0;$car<strlen($word);$car++)
> {
> file://echo "lettre : $word[$car] - \t";
> if ($letter_value=$tab[$word[$car]])
> $word_value+=$letter_value;
> }
> file://echo "mot : $word; ";
> file://echo "valeur : $word_value\n<br>\n";
> if ($word_value==100)
> echo "the word <b>$word</b> on line $line_value of
> the input file has a value of $word_value.<br>\n";
> }
> }
> echo "<br>\n<font color=\"red\">If nothing appears above, no word
with
> a value of 100 was found !!!\n";
>
> ?>
> </body>
> </html>
>
>
> (°- Nayco,
> //\ [EMAIL PROTECTED]
> v_/_ http://nayco.free.fr
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]