In python we have:
for i in range(length)
What about in PHP?
Straight from the docs:
foreach (range(0, 12) as $number) {
echo $number;
}
Old fashioned for
loops:
for ($i = 0; $i < length; $i++) {
// ...
}
Or foreach using the range function:
foreach (range(1, 10) as $i) {
// ...
}
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