search

Home  >  Q&A  >  body text

The browser has printed out 6, but why is the error reported above?

<?php

for($i=0;$i<5;$i ){

$a = $i;

}

echo $a;

?>

The browser has printed out 6, but why is the error reported above?

qq.png

叶2136 days ago954

reply all(3)I'll reply

  • 移动用户-2814869

    移动用户-28148692019-02-28 22:49:40

    It is not defined the first time through the loop. The second time, $a has a value, so of course the result can be output.

    reply
    0
  • 叶

    Haha thank you!

    · 2019-03-01 10:06:43
  • Cancelreply