我是使用Symfony2框架的新手.我以前在Laravel框架上做了一点工作,它index.php在public文件夹中有一个文件,这是该应用程序的主要入口点.但我不确定在index.phpSymfony框架项目中找到类似文件的位置 - Symfony有类似的东西吗?
我想在PHP中使用for循环对数字求和.
喜欢:'1+2+3+4+5+6+7+8+9+10=?'
这将使用
<?php
$start = 1;
$end = 10;
$sum = 0;
for ($i = $start; $i <= $end; $i++) {
$sum += $i;
}
echo "Sum from " . $start . " to " . $end . " = " . $sum;
?>
Run Code Online (Sandbox Code Playgroud)
输出为:-Sum从1到10 = 55.
但是我希望输出如下:
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55
我怎样才能做到这一点?