PHP hexadecimal random color generator function example, hexadecimal Generator
This example describes the PHP hexadecimal color random generator function. We will share this with you for your reference. The details are as follows:
<? Phpfunction randomColor () {$ str = '#'; for ($ I = 0; $ I <6; $ I ++) {$ randNum = rand (0, 15 ); switch ($ randNum) {case 10: $ randNum = 'a'; break; case 11: $ randNum = 'B'; break; case 12: $ randNum = 'C '; break; case 13: $ randNum = 'D'; break; case 14: $ randNum = 'E'; break; case 15: $ randNum = 'F'; break ;} $ str. = $ randNum;} return $ str;} $ color = randomColor (); echo $ color;?>
Running result: #8ABED4
PS: Here are some related color tools for your reference:
RGB color encoding generator:
Http://tools.jb51.net/color/rgb_color_generator
RGB color query table _ color code table _ English name of the color Daquan:
Http://tools.jb51.net/color/jPicker
Online Web page palette tool:
Http://tools.jb51.net/color/color_picker
Online color selector tool/RGB color query table:
Http://tools.jb51.net/color/colorpicker