Is there a way to use PHP range()
for a really small number? like below?
range(0.54,0.58);
Doing this creates an error.
range(): step exceeds the specified range in
The third parameter is the step
.
Reading the documentation is a very good place to start.
If you read you will see that you can set the step to something that can increment between your limits.
The error message is simply telling you that it cannot increment 0.54 by 1 without going over 0.58 - think about, it 1 + 0.54 is more than 0.58!
Using this line instead will give you the desired output.
range(0.54, 0.58, 0.01);
The error message is self-explanatory: the default value of $range
(the third argument of range()
) is 1
and using it produces an empty range.
Provide a third argument to range()
. From the value of $start
and $end
I think 0.01
is the step you need:
range(0.54, 0.58, 0.01)
Check it out: https://3v4l.org/IcUAh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With