Random Background Color using PHP & HTML

In this post, we are going to see how to write a simple PHP program to generate Random Background Color and for every refresh, we are going to change the background color.

Let’s write the PHP snippet first which gives us a random color code every time we refresh the page.

Now we have the color code, let us set the background color in the <body> tag.

That’s it. We have a PHP & HTML script that produces Random Background Color every time when we refresh the page. You can check the demo from the below link.


Related Posts

Leave a Reply