To break it down, range(0, 1)
creates an array which contains two values: 0 and 1. So if you loop over it, you're going to do so twice. The first time, $value
will be 0 and the second time, $value
will be 1.
$i
is a value which counts how many iterations there has been. So the first iteration it will have a value of 1, and the second iteration it will have a value of 2.
With all of that in mind, the output you're getting is expected.