note 98764 deleted from function.dechex by danbrown
| From: | danbrown@php.net | Date: | Tue, 06 Jul 2010 13:02:10 +0000 |
| Subject: | note 98764 deleted from function.dechex by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170734@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
/**
*
* is_hex() for a BIG hex string.
*
**/
function is_hex($hex)
{
$hex = strtolower(trim(ltrim($hex,"0")));
if (empty($hex)) { $hex = 0; };
$arr=str_split($hex);
$len=strlen($hex);
for($i=0; $i < $len; $i++)
{
$dec = hexdec($arr[$i]);
if($arr[$i] <> dechex($dec)) return false;
}
return true;
}