User Tools

Site Tools


scratch
<?php
$word_file = file_get_contents("/usr/share/dict/words");
$words = explode("\n", $word_file);
foreach($words as $key=>$word) {
        $word = strtolower($word);
        $last_letter = 0;
        for($i=0;$i<strlen($word);$i++) {
                $num_letter = ord($word[$i]);
                if($num_letter < $last_letter)
                        unset($words[$key]);
                $last_letter = $num_letter;
        }
}
print_r($words);
?>
scratch.txt · Last modified: 2020/11/26 15:41 by admin