Pages

Wednesday, December 5, 2018

Random Color return in PHP function


function random_background_image(){
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
return $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]."45";
}

// function call
echo random_background_image();

No comments:

Post a Comment