PHP: loop from 3 to 50 with 0.2 step

Started by evejones, Aug 13, 2022, 02:56 AM

Previous topic - Next topic

evejonesTopic starter

Tell me please, how to make a cycle from 3 to 50 with a step of 0.2?
  •  

offka

I may not quite understand, but it seems like that:

<?php

echo "<xmp>";

for(
$i 3$i <= 50$i 0.2)
{
    echo 
"{$i}\r\n";
}

echo 
"</xmp>";

?>

or this:

<?php

$arr 
range(3500.2);

foreach (
$arr as $i)
    {
        echo 
$i' ';
    }  
?>

good tone - always make loops integer.
from 30 to 500, and then divide by 10, or add to another variable
  •