note 83338 added to function.imagecolorallocate
| From: | federicot at gmail dot com | Date: | Wed, 21 May 2008 14:08:28 +0000 |
| Subject: | note 83338 added to function.imagecolorallocate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139583@lists.php.net to get a copy of this message | ||
Little correction to marc-gutt's regural expression to validate hex color values. You can use
this little function:
<?php
// Validate an hex color string. Return true if valid, false otherwise
function validateHexColor($color) {
$color = substr($color, 0, 7);
return preg_match('/#[0-9a-fA-F]{6}/', $color);
}
?>
----
Server IP: 201.216.232.3
Probable Submitter: 200.126.254.144
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorallocate.php
Edit -- https://master.php.net/note/edit/83338
Del: integrated -- https://master.php.net/note/delete/83338/integrated
Del: useless -- https://master.php.net/note/delete/83338/useless
Del: bad code -- https://master.php.net/note/delete/83338/bad+code
Del: spam -- https://master.php.net/note/delete/83338/spam
Del: non-english -- https://master.php.net/note/delete/83338/non-english
Del: in docs -- https://master.php.net/note/delete/83338/in+docs
Del: other reasons-- https://master.php.net/note/delete/83338
Reject -- https://master.php.net/note/reject/83338
Search -- https://master.php.net/manage/user-notes.php