So having run into the topic “Slovoom” - a small word game, I sowed the site and understood the hopelessness of the project.Scratching a turnip for 20 minutes, he put an anti-word on php:
')
Do not carp at Dizo, everything was done quickly and soundly.
If anyone is interested in the implementation - we look under the cut
Simplicity - the guarantee of health. I did not bother with speed optimization - I used the super powerful and at the same time super slow php function - similar_text
similar_text()
: int similar_text(string str_first, string str_second [, double percent])
.
similar_text() . , str_first str_second. .
For those who chop php, you can not read further. all clear.
And for those who are interested - I cite the source
podbor.php:
<? php $ file = fopen ( "w.txt" , "r" ) ; if ( ! file ) { echo ( "Error opening file" ) ; } else { echo 'The word base is open ' ; echo 'Parsim word:' . $ word . '
' ; $ counter = 0 ; while ( ! feof ( $ file ) ) { $ str = fgets ( $ file ) ; $ res = similar_text ( $ word , $ str ) ; $ len = strlen ( $ str ) - 1 ; if ( ( $ res == $ len ) && ( $ len > 1 ) && ( $ old ! = $ str ) ) { echo $ str . '(' . $ len . 'letters) ' ; $ counter ++; $ old = $ str ; } } echo ' Total words found: $ counter ; } fclose ( $ file ) ; ?>
Voila next to the pages we place the w.txt file containing a bunch of words (such as are easy to find in nete, for example, here )