I want to generate a list of numbers with a 0.25
difference between them, e.g
0
0.25
0.50
0.75
1
1.25
.....
9.75
10
How can this be done?
I want to generate a list of numbers with a 0.25
difference between them, e.g
0
0.25
0.50
0.75
1
1.25
.....
9.75
10
How can this be done?
Just use a for() loop.
for($i=0;$i<=10;$i+=0.25)
echo $i,'<br />';
Use the range()
function. You can specify a step (0.25):
$numbers = range(0, 10, 0.25);
foreach ($numbers as $number) {
echo "$number\n";
}