I have a special problem over in terms of sorting out those words like a keyboard type.
For example:
the user inputs these words into the textarea
HOUSE
DOLL
KITE
NICE
Then, the result should be
DOLL
HOUSE
KITE
NICE
this is sorted out according to the qwerty order.
<?php
$words = array();
$order=array('q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m');
$qwerty_words = array();
if(isset($_POST['submit'])){
$text = $_POST['texts'];
$text = "one two free";
$separate_of_texts = explode(" ",$text);
//$words = array($separate_of_texts);
$count_words = count($separate_of_texts);
$count_order = count($order);
//storing array values
for($i= 0; $i<$count_words;$i++){
$words[$i]=$separate_of_texts[$i];
}
for($i=0;$i<$count_words;$i++){
$temp = array();
$sep_letters=explode(' ',$words[$i]);
if(!in_array($sep_letters[$i], $order)){
}
}
foreach($qwerty_words as $values){
echo $values.'<br/>';
}
echo '<br/>'.$count_words;
//}
?>
The code above is mine and I don't know what kind of algo will use for this kind of problem