You can get the same output with for and while loops:
While:
$i = 0; while ($i <= 10){ print $i.\"\\n\"; $i++; };
I find the fastest loop is a reverse while loop, e.g:
var i = myArray.length; while(i--){ // Do something }