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. Quote Link to comment 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){ } Quote Link to comment 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 } Quote Link to comment 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.