Home  >  Article  >  Backend Development  >  Example of generating random color codes in php_PHP tutorial

Example of generating random color codes in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:00:361093browse

This article introduces to students an example of generating random color codes in PHP. Friends who need to learn more can refer to it.

 代码如下 复制代码
function randrgb() 

  $str='0123456789ABCDEF'; 
    $estr='#'; 
    $len=strlen($str); 
    for($i=1;$i<=6;$i++) 
    { 
        $num=rand(0,$len-1);   
        $estr=$estr.$str[$num];  
    } 
    return $estr; 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631251.htmlTechArticleThis article introduces to students an example of generating random color codes in PHP. Friends who need to learn more can refer to it. The code is as follows Copy code function randrgb() { $str='0123456789ABCDEF';...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn