soma56 Posted June 9, 2010 Share Posted June 9, 2010 I know it's a stupid question however if I had a simple program that did this: <?PHP //INSTANCE ONE $i = 1; while ($i <= 10) { echo $i++; } //INSTANCE TWO $A = 1; while ($i <= 10) { echo $A++; } //INSTANCE THREE $Z = 1; while ($i <= 10) { echo $z++; } ?> What seems to happen is that the program will output each one in order before moving to the next 'while' rather then all at the same time or 'simultaneously' output all three. Just curious if there's another way. Link to comment https://forums.phpfreaks.com/topic/204333-is-there-a-way-to-have-multiple-instances-of-while/ Share on other sites More sharing options...
trq Posted June 9, 2010 Share Posted June 9, 2010 Scripts execute from top to bottom, what exactly do you expect to happen? Link to comment https://forums.phpfreaks.com/topic/204333-is-there-a-way-to-have-multiple-instances-of-while/#findComment-1070127 Share on other sites More sharing options...
StedeTroisi Posted June 9, 2010 Share Posted June 9, 2010 I know it's a stupid question however if I had a simple program that did this: <?PHP //INSTANCE ONE $i = 1; while ($i <= 10) { echo $i++; } //INSTANCE TWO $A = 1; while ($i <= 10) { echo $A++; } //INSTANCE THREE $Z = 1; while ($i <= 10) { echo $z++; } ?> What seems to happen is that the program will output each one in order before moving to the next 'while' rather then all at the same time or 'simultaneously' output all three. Just curious if there's another way. For the most part, computers can do nothing simultaneously. Each action comes before the other. What is your desired output? Link to comment https://forums.phpfreaks.com/topic/204333-is-there-a-way-to-have-multiple-instances-of-while/#findComment-1070129 Share on other sites More sharing options...
premiso Posted June 9, 2010 Share Posted June 9, 2010 If you want to output all three at the same time, collect them in a string or look into output buffering via ob_start and ob_get_clean. And then just echo that one string and viola. If you are wanting it to run all 3 simultaneously, I know of no way to do it other then opening 3 different pages which have 3 different whiles "at the same time". Link to comment https://forums.phpfreaks.com/topic/204333-is-there-a-way-to-have-multiple-instances-of-while/#findComment-1070131 Share on other sites More sharing options...
soma56 Posted June 9, 2010 Author Share Posted June 9, 2010 I just wanted to know if it was possible, that's all. Thank you. Link to comment https://forums.phpfreaks.com/topic/204333-is-there-a-way-to-have-multiple-instances-of-while/#findComment-1070134 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.