Matching hexadecimal color values


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $string = "#555555";
  2. if (preg_match('/^#(?:(?:[a-fd]{3}){1,2})$/i', $string)) {
  3. echo "example 6 successful.";
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.