<form action=" " method="GET">
<input type="text" name="text" value="">
<input type="submit">
</form>
<?php
if (isset($_GET['text'])) {
$text = $_GET['text'];
}
else{
$text = "";
}
$words = [
'apple',
'work',
'tree',
'flover',
'green',
'strong'
];
$strlen = strlen($text);
for ($i=0; $i < $strlen; $i++) {
foreach ($words as $word) {
if (stripos($word, $text[$i])) {
echo $word . " - <b>[$text[$i]]</b>" . "<br>";
}
}
}