<?php
$a=1;
$b=3;
while ($a<=5)
{
$b=$b+$a;
$a++;
}
echo $b;
?>

<?php
$a=5;
$b=1;
for ($c=1;$c<=4;$c++)
{
$a=$a+$c;
$b=$b+$a;
}
echo $b;
?>

<?php
$a=1;
$b=2;
$c=3;
while ($a<=3)
{
if ($b<5)
{
$b=$b+$c;
}
else
{
$b=$b-$c;
$a++;
}
}
echo $b;
?>

<?php
$a=1;
$b=2;
$c=3;
while($a<=2)
{
for ($d=1;$d<=2;$d++)
{
if ($b>2)
{
$b=$b+$a;
$c=$c+1;
}
else
{
$b=$b+$c;
$c=$c-1;
}
}
$a++;
}
echo $b;
?>