while(1){ // something before if (//data to read) { $loop->loop_once; } // something after }