ratcateme Posted March 9, 2008 Share Posted March 9, 2008 I want to create an IRC bot the idea is that the script never ends until i send a kill message in IRC but i want to know about the best way to create the continuous loop that will check if any new messages have been sent on the server and respond to any commands sent to the bot this is what i have at the moment <?php while(1==1){ //read stream //do stuff } ?> my question is weather 1==1 is the best way to create a loop or if i should use something else. Scott. Link to comment https://forums.phpfreaks.com/topic/95182-continuous-loop/ Share on other sites More sharing options...
roopurt18 Posted March 9, 2008 Share Posted March 9, 2008 Most people would just write: while(1){ } // OR while(true){ } Link to comment https://forums.phpfreaks.com/topic/95182-continuous-loop/#findComment-487530 Share on other sites More sharing options...
azfar siddiqui Posted March 9, 2008 Share Posted March 9, 2008 //while infinite loop while(1) { // your code } //alternative while(true) { // your code } //For Infinite Loop for($i=0; ;$i++) { //your code } Link to comment https://forums.phpfreaks.com/topic/95182-continuous-loop/#findComment-487549 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.