How to show words spell for list in php. Example
$word=bat;
if a=angry
b=beautiful
t=thin
echo $word;
result
b=beautiful
a=angry
t=thin
If I understood correctly, you should have array with words, and use your word as Char
array. So in the end, I would propose, something like this:
function spell_word($word){
$spell_words = array("a"=>"angry", "b"=>"beautiful", "t"=>"thin" );
$result = array();
for( $index=0; $i < strlen( $word ); $i++ ){
$result[] = array( "letter"=> $word[i], "word" => $spell_words[$word[i]]);
}
return $result;
}
var_dump(spell_word("bat"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.