Jump to content

[SOLVED] question about this for loop


silverglade

Recommended Posts

hi, i cant understand why the loop doesnt print 2 3 4  as its first iteration, but instead it prints 1, 1, 1. any help greatly appreciated. thanks. derek

 

 

<?php

for ($x = 1, $y = 1, $z = 1; //declaration
     $y < 10, $z < 10;  //if this
 $x = $x + 1, $y = $y + 2, //do this
 $z = $z +3)
 echo  "$x, $y, $z , <br />"; //then output this, why is this not 2, 3, 4  first?




?>

Link to comment
https://forums.phpfreaks.com/topic/174316-solved-question-about-this-for-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.