Advertisement
killerbng

PHP loop with decimals

May 15th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.14 KB | None | 0 0
  1. $start = 0.1;
  2. $end = 12;
  3. $place = 1;
  4. $step = 1 / pow(10, $place);
  5. for($i=$start;$i<=$end;$i=round($i+$step,$place)){
  6.     echo $i . "\n";
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement