canabatz Posted December 23, 2011 Share Posted December 23, 2011 how can a get this result in for loop: 1 4 1 5 1 6 2 4 2 5 2 6 3 4 3 5 3 6 thanks Link to comment https://forums.phpfreaks.com/topic/253744-for-loop-in-for-loop/ Share on other sites More sharing options...
SergeiSS Posted December 23, 2011 Share Posted December 23, 2011 Did you try to write a code to solve this? Maybe 5-7 lines? Link to comment https://forums.phpfreaks.com/topic/253744-for-loop-in-for-loop/#findComment-1300827 Share on other sites More sharing options...
canabatz Posted December 23, 2011 Author Share Posted December 23, 2011 im little bit sick , it was hard for me to think well , any way thanks for th push for ($i=1; $i<=3; $i++) { for ($z=4; $z<=6; $z++) { echo $i; echo $z."<br>"; } } Link to comment https://forums.phpfreaks.com/topic/253744-for-loop-in-for-loop/#findComment-1300829 Share on other sites More sharing options...
SergeiSS Posted December 23, 2011 Share Posted December 23, 2011 If you remove empty strings and combine echos.... You'll get exactly 7 lines Link to comment https://forums.phpfreaks.com/topic/253744-for-loop-in-for-loop/#findComment-1300834 Share on other sites More sharing options...
canabatz Posted December 23, 2011 Author Share Posted December 23, 2011 Exactly Thanks SergeiSS Link to comment https://forums.phpfreaks.com/topic/253744-for-loop-in-for-loop/#findComment-1300841 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.