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

Example of generating random color codes in php_PHP tutorial

WBOY
Release: 2016-07-13 17:00:36
Original
1164 people have browsed it

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';...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template