random color


SUBMITTED BY: phpsnippets

DATE: Oct. 21, 2015, 2:08 p.m.

FORMAT: Text only

SIZE: 294 Bytes

HITS: 1657

  1. <?php
  2. function randColor(){
  3. $letters = "1234567890ABCDEF";
  4. for($i=1;$i<6;$i++){
  5. $pos = rand(0,16);
  6. $str .= $string{$pos};
  7. }
  8. return "#".$str;
  9. }
  10. echo '<span style="color:'.randColor().'">Random Color Text</span>';
  11. ?>

comments powered by Disqus