function is_hexbin($value) { // First see if there are any invalid chars. if (!strlen($value) || preg_match('/[^A-Fa-f0-9]/', $value)) { return false; } return strcasecmp($value, SOAP_Type_hexBinary::to_hex(SOAP_Type_hexBinary::to_bin($value))) == 0; }
function is_hexbin($value) { # first see if there are any invalid chars $l = strlen($value); if ($l < 1 || strspn($value, '0123456789ABCDEFabcdef') != $l) { return FALSE; } $bin = SOAP_Type_hexBinary::to_bin($value); $hex = SOAP_Type_hexBinary::to_hex($bin); return strcasecmp($value, $hex) == 0; }