Amit Dhamu

Writes Code

Generate Random Colour

$rand = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");

$random_colour = "#" . $rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];



Also, an alternate one-liner:

$random_colour = "#" . strtoupper(dechex(rand(0,10000000)));


random colour / php

← Copy To Clipboard In Flex PHP Range →