Korzystam z takiej klasy
<?php $word = 'pozycjonowanie'; class cTypoGenerator { // array of keys near character on a QWERTY keyboard // only valid characters in a domain name // top row // 2nd from top // home row // bottom row ); // accepts a string // returns array of likely single "wrong key" typos // arrays contain only characters that are valid domain names function getWrongKeyTypos( $word ) { // check each character for( $i = 0; $i < $length; $i++ ) { // if character has replacements then create all replacements if( cTypoGenerator::$keyboard[$word{$i}] ) { // temp word for manipulating $tempWord = $word; foreach( cTypoGenerator::$keyboard[$word{$i}] as $char ) { $tempWord{$i} = $char; } } } return $typos; } // accepts a string // returns array of likely single missed character typos // arrays contain only characters that are valid domain names function getMissedCharTypos( $word ) { // check each character for( $i = 0; $i < $length; $i++ ) { $tempWord = ''; if( $i == 0 ) { // at first character } else if ( ( $i + 1 ) == $length ) { // at last character } else { // in between } } return $typos; } // accepts a string // returns array of likely transposed character typos // arrays contain only characters that are valid domain names function getTransposedCharTypos( $word ) { // check each character for( $i = 0; $i < $length; $i++ ) { if( ( $i + 1 ) == $length ) { // could have simplified the test by throwing it in the for loop but I didn't to keep it readable // at the end no transposition } else { $tempWord = $word; $tempChar = $tempWord{$i}; $tempWord{$i} = $tempWord{( $i + 1 )}; $tempWord{( $i + 1 )} = $tempChar; } } return $typos; } // accepts a string // returns array of likely double entered character typos // arrays contain only characters that are valid domain names function getDoubleCharTypos( $word ) { // check each character for( $i = 0; $i < $length; $i++ ) { // get first part of word // add a character $tempWord .= $word{$i}; // add last part of strin if there is any if( $i == ( $length - 1 )) { // do nothing we are at the end } else { // add the end part of the string } } return $typos; } ?>
proszę używać poprawnego bbcode.
poprawiam
revyag
niestety obecnie mam serwer z php4 i juz mi to nie chodzi bo static jest tylko w php5 (chyba)
Czy da sie to jakoś przerobić żeby poszlo w php4?
bo potrzebuje to do strony ze slownikiem gdzie generowane sa potencjalne bledy w wyrazach.