Blu23 Posted April 10, 2011 Share Posted April 10, 2011 Okay so I've been going over the PHP manual doing test applications as I go along and I came across this issue that honestly totally threw me. I figured it out (after 20 minutes of thinking the world was about to end) so thought I'd post the code and although some experts will simply shake their head others will hopefully see the funny side. So I'm running a simple script iterating through two arrays and outputting some text. Code is below. <?php for($i = 0;$i < 100;$i++){ for($k =0; $k < 100;$k++){ echo "$i and $k"; } } ?> I'd have expect to get something along the lines of 00 and 01 and 02 and 03 etc... but as you have probably guessed that's not what I was getting. Instead I was getting 0 and 00 and 10 and 20 and 30. Anyway figured it all out now and I'm hanging my head in shame. Quote Link to comment https://forums.phpfreaks.com/topic/233291-so-stupid/ Share on other sites More sharing options...
spiderwell Posted April 10, 2011 Share Posted April 10, 2011 its all good learning though Quote Link to comment https://forums.phpfreaks.com/topic/233291-so-stupid/#findComment-1199743 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.