Search code examples
phppythonrange

Is there something like for i in range(length) in PHP?


In python we have:

for i in range(length)

What about in PHP?


Solution

  • Straight from the docs:

    foreach (range(0, 12) as $number) {
        echo $number;
    }