Home >Backend Development >PHP Tutorial >How to generate random colors in php, php generation_PHP tutorial

How to generate random colors in php, php generation_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:14:171026browse

How to generate random colors in php, generate

in php

The example in this article describes how to generate random colors in PHP. Share it with everyone for your reference. The specific implementation method is as follows:

Copy code The code is as follows:

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;
}


I hope this article will be helpful to everyone’s PHP programming design.

http://www.bkjia.com/PHPjc/910588.html

truehttp: //www.bkjia.com/PHPjc/910588.htmlTechArticleHow to generate random colors in php, php generation This article describes how to generate random colors in php. Share it with everyone for your reference. The specific implementation method is as follows: Copy the code The code is as follows...
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