I have a quick question, which is probably easy to answer. I've goolged around, but not sure if I am searching correctly or what. Anyway, using PHP, how can I increment by halves?
For example, I know I can use the following loop:
<?php
for ($i=1; $i<21; $i++) {
print($i);
}
And it will print 1 - 20.
But, how can I get it to output something like the following:
1
1.5
2
2.5
etc...
Sorry for my ignorance on this, I'm just not sure how to go about it. Thanks!
instead of $i++
, use $i += .5
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