Facebook
From Toxic Dormouse, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 185
  1. <?php
  2.  
  3.  
  4.  
  5. function randomHex() {
  6.    
  7.    
  8.    $chars = 'ABCDEF0123456789';
  9.    $color = '#';
  10.    for ( $i = 0; $i < 6; $i++ ) {
  11.       $color .= $chars[rand(0, strlen($chars) - 1)];
  12.    }  
  13.    
  14.  
  15.    return $color;
  16. }
  17.  
  18.  
  19. echo json_encode(randomHex());
  20.  
  21. ?>