I have a variable named $myColor like the above.Code:<?php $myColor="0000ff"; ?>
I like to verify whether the value of $myColor is color code or not.
The following code doesn't work correctly, but I hope it shows what I want.
Code:code1 <?php $myColor="0000ff"; if ( is_colorCode($myColor) ) {echo yes;} else { echo no;} ?> result1 yes
Code:code2 <?php $myColor="0xy0000"; if ( is_colorCode($myColor) ) {echo yes;} else { echo no;} ?> result2 no



Reply With Quote



Bookmarks