是否有可能在PHP echo
有for loop
它里面?像这样的东西:
echo "This are the list" . for($i=0; $i<=$count; $i++) { echo $variable1 . $variable2} . "End";
Run Code Online (Sandbox Code Playgroud)
我的代码是这样的.
但我仍然遇到错误.
循环不要进入echo语句.将它们分开
echo "This are the list";
for($i=0; $i<=$count; $i++)
{
echo $variable1 . $variable2;
}
echo "End";
Run Code Online (Sandbox Code Playgroud)
将通过以下方式生成更可读的输出版本:
echo "This is the list: <br>";
for($i=0; $i<=$count; $i++)
{
echo $variable1. " ". $variable2."<br>";
}
echo "End";
Run Code Online (Sandbox Code Playgroud)