PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Hex

Zend_Validate_Hex allows you to validate if a given value contains only hexadecimal characters. These are all characters from 0 to 9 and A to F case insensitive. There is no length limitation for the input you want to validate.

<?php
$validator 
= new Zend_Validate_Hex();
if (
$validator->isValid('123ABC')) {
    
// value contains only hex chars
} else {
    
// false
}

Invalid characters

All other characters will return false, including whitespace and decimal point. Also unicode zeros and numbers from other scripts than latin will not be treaten as valid.

Supported options for Zend_Validate_Hex

There are no additional options for Zend_Validate_Hex:

Zend Framework