Random color hex


/ Published in: PHP
Save to your folder(s)

Random color hex


Copy this code and paste it in your HTML
  1. function random_color(){
  2. mt_srand((double)microtime()*1000000);
  3. $c = '';
  4. while(strlen($c)<6){
  5. $c .= sprintf("%02X", mt_rand(0, 255));
  6. }
  7. return $c;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.