$a=0 $b=0 for ($1=0,$1<5,$1++){$a+=10 $b+=5} echo ("$a$b"); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

$a=0 $b=0 for ($1=0,$1<5,$1++){$a+=10 $b+=5} echo ("$a$b");

please can you explain how this code runs

2nd Jun 2018, 6:08 PM
Webster - avatar
3 Answers
+ 6
Latudanee the for loop should for($i=0;$i<5;$i++) not for($i=0,$i<5,$i++) its semicolons not commas
2nd Jun 2018, 6:32 PM
᠌᠌Brains[Abidemi] - avatar
+ 3
I got this questions in php quiz and the answers was 5025
2nd Jun 2018, 6:23 PM
Webster - avatar
+ 1
Maybe you misread l or i as 1? because the code will produce the result you mentioned if its a valid variable
2nd Jun 2018, 6:26 PM
Max - avatar