PHP Tip: Random color
December 13th, 2010 by Phong Vu    

This function return random color hex value:

function random_color(){
    mt_srand((double)microtime()*1000000);
    $c = '';
    while(strlen($c)<6){
        $c .= sprintf("%02X", mt_rand(0, 255));
    }
    return $c;
}

You might also be interested in:

Share your thought:

 
Web design by Phong Vu - All content posted on here is copyright by Phong Vu and its rightful owner.