Code to Algorithm Round Robin in PHP