Here is another example.
Let say your age is 24 and you want to display all the years
from year 1 to 24.
So your intial value is 1 and last value is 24
for($myage=1;$myage<=24;$myage++){
echo"$myage<br>";
}
The above code print age from 1 to 24..Its increment by 1 year
$myag++ could write as $mysage=$myage+1
if i crement by 2 , How many output you will get ?
write the following code and see
for($myage=1;$myage<=24;$myage=$myage+2){
echo"$myage<br>";
}
Here is example to printout 7 days from now on ..
<?php
$starttime=time();
$endtime=$starttime+6*86400;
// 86400 seconds a day, so for (6 days +today )= 7days
for($time=$starttime;$time<=$endtime;$time=$time+86400){
echo"".date("d-m-Y","$time")."<br>";
}
?>