Вы можете использовать str_replace
для достижения этой цели следующим образом: Следующий ответ - пример, связанный с вашей проблемой.
$answer = ["apple","ball","cat","doll"];
$text = "<p>It is a long TEXT_FIELD_SMALL_0 established fact TEXT_FIELD_SMALL_1 that a reader will TEXT_FIELD_SMALL_2 be distracted TEXT_FIELD_SMALL_3 by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here</p>";
$arr_to_replace =["TEXT_FIELD_SMALL_0","TEXT_FIELD_SMALL_1","TEXT_FIELD_SMALL_2","TEXT_FIELD_SMALL_3"];
$arr_replace_by = array();
foreach($answer as $ak => $av){
$arr_replace_by[] = '<input type="text" value="'.$av.'"></input>';
}
$text = str_replace($arr_to_replace,$arr_replace_by,$text);
echo $text;
И в вашем случае вы можете получить $answer
с $request->answer