Need Help With The Easiest Logic

ok so i need help in sorting out the easiest way to do this

i have 4 diffrent servers from where i can pull data what i want to do is

In the first visit it pulls data from server 1 then from the second visit it pulls data from server 2 then from server 3 and then from server 4 and 4 is used again back to 1

right now i am doing this using php random but it wont equally distribute it this way

can u tell me how to do this the easiest way ?

Put the four servers behind a load-balancer, then access the load-balancer instead of the servers directly. By-the-way, I am referring to a hardware based load-balancer not software. Trying to emulate a load-balancer in PHP is foolhardy nor reliable.

You could also store “last_used_server_id” in a database. Then when there’s a page visit, just pull the last_used_server_id from the DB and use that to determine which server to use next.