0

How this ans...?

<?php $i='5'; for($i=0;$i<7;$i++){ ++$i; echo $i; } ?> output:1357

13th Jun 2017, 12:41 PM
boopathi raja
boopathi raja - avatar
1 Odpowiedź
+ 1
because you are incrementing $i by two, one time inside the for loop and the other when the loop ends an iteration. $i = '5' is overwritten as PHP has dynamic typing
13th Jun 2017, 1:13 PM
Alejandro Serrato
Alejandro Serrato - avatar