以下にテキスト入力があります:
'<input type=\"text\" name=\"indivoptions\" class=\"options\" id=\"answer".$option."\" name=\"answerName[$option]\" value=\"$option\" />'
ここで、一般的な文字列出力ではなく、テキスト入力で展開後にそれぞれを表示したいのです$option
が、上のコードを下のコードのどこに配置しますか?
$options = explode('-', $option);
if(count($options) > 1) {
$start = array_shift($options);
$end = array_shift($options);
do {
$options[] = $start;
}while(++$start <= $end);
}
現在のコード:
function ExpandOptionType($option) {
$options = explode('-', $option);
foreach($options as $answers) {
$answers = '<p><input type=\"checkbox\" name=\"anstype\" class=\"answers\" id=\"answer".$option."\" name=\"answerName[$option]\" value=\"$option\" />$option</p>';
}
if(count($options) > 1) {
$start = array_shift($options);
$end = array_shift($options);
do {
$options[] = $start;
}while(++$start <= $end);
}
else{
$options = explode(' or ', $option);
}
return implode(" ", $options);
}