I want PHP to execute a method in a loop to detect communication until the client returns true to stop the loop, otherwise it will continue to loop communication 10 times. What is the best way to implement this type of loop execution method? Because thousands of checks are required at the same time, it may be resource-intensive.