php for 10 for echo substr -3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<?php
$s = 0;
for($i=1;$i<=10;$i++)
{
$f = 1;
for($n=2;$n<=$i;$n++)
$f *= $n;
$r .= " $f + ";
$s += $f;
}
echo substr($r, 0, -3 )," = ",$s;