strlen

From: Date: Wed, 25 Jul 2001 20:19:12 +0000
Subject: strlen
Groups: php.general 
Request: Send a blank email to php-general+get-59598@lists.php.net to get a copy of this message
I'm having a heck of a time getting something to work like it should I have a script which reads a list of words one per line I want it to display the length of the word a tab then the word. No matter how I code it it still only shows the word alone on strlen. Any ideas? <? $handle = fopen ("./ospd3.txt", "r"); while (!feof($handle)) { $wordlist[]=fread($handle,4096); } fclose($handle); uasort($wordlist, "sortbylength"); foreach ($wordlist as $word) { $lent = strlen($word); print "$lent"."\t"."$word"."\n"; } exit; function sortbylength($arr,$brr) { $alen = strlen($arr); $blen = strlen($brr); if ($alen == $blen) { return 0; } return ($alen > $blen) ? -1 : 1; } ?> sample of the ospd3.txt megacities memorising nitpickier outpowered outslicked pinwheeled prebooking ratcheting rebreeding redialling reexposing repatching romanising showbizzes sparkliest suctioning sunporches vitreouses whatnesses windsurfed zombifying backdropped backfitting beglamoring chainsawing coanchoring deadlifting Thanks

« previous php.general (#59598) next »