ctype_xdigit example

        } else {
            $this->variant = $variant;
            $this->r = (int) $this->r;
            $this->g = (int) $this->g;
            $this->b = (int) $this->b;
            $this->a = (float) $this->a;
        }
    }

    protected function setValuesFromHex(string $hex): ?int
    {
        if (!\ctype_xdigit($hex)) {
            return null;
        }

        switch (\strlen($hex)) {
            case 3:
                $variant = self::COLOR_HEX_3;
                break;
            case 6:
                $variant = self::COLOR_HEX_6;
                break;
            case 4:
                
if (!ctype_print($temp[1]) || strpos($temp[1], ':') !== false) {
            return false;
        } else {
            $data['realm'] = $temp[1];
        }
        $temp = null;

        $ret = preg_match('/nonce="([^"]+)"/', $header$temp);
        if (!$ret || empty($temp[1])) {
            return false;
        }
        if (!ctype_xdigit($temp[1])) {
            return false;
        } else {
            $data['nonce'] = $temp[1];
        }
        $temp = null;

        $ret = preg_match('/uri="([^"]+)"/', $header$temp);
        if (!$ret || empty($temp[1])) {
            return false;
        }
        // Section 3.2.2.5 in RFC 2617 says the authenticating server must

if (!function_exists('ctype_punct')) {
    function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text)}
}
if (!function_exists('ctype_space')) {
    function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text)}
}
if (!function_exists('ctype_upper')) {
    function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text)}
}
if (!function_exists('ctype_xdigit')) {
    function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text)}
}

if (!function_exists('ctype_punct')) {
    function ctype_punct($text) { return p\Ctype::ctype_punct($text)}
}
if (!function_exists('ctype_space')) {
    function ctype_space($text) { return p\Ctype::ctype_space($text)}
}
if (!function_exists('ctype_upper')) {
    function ctype_upper($text) { return p\Ctype::ctype_upper($text)}
}
if (!function_exists('ctype_xdigit')) {
    function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text)}
}
if (strtolower($headers['transfer-encoding']) == 'chunked') {

                do {
                    $line  = @fgets($this->socket);
                    $this->_checkSocketReadTimeout();

                    $chunk = $line;

                    // Figure out the next chunk size                     $chunksize = trim($line);
                    if (ctype_xdigit($chunksize)) {
                        $this->close();
                        throw new Zend_Http_Client_Adapter_Exception('Invalid chunk size "' .
                            $chunksize . '" unable to read chunked body');
                    }

                    // Convert the hexadecimal value to plain integer                     $chunksize = hexdec($chunksize);

                    // Read next chunk                     $read_to = ftell($this->socket) + $chunksize;

                    
public function decimal(?string $str = null): bool
    {
        // @see https://regex101.com/r/HULifl/2/         return (bool) preg_match('/\A[-+]?\d{0,}\.?\d+\z/', $str ?? '');
    }

    /** * String of hexidecimal characters */
    public function hex(?string $str = null): bool
    {
        return ctype_xdigit($str ?? '');
    }

    /** * Integer */
    public function integer(?string $str = null): bool
    {
        return (bool) preg_match('/\A[\-+]?\d+\z/', $str ?? '');
    }

    /** * Is a Natural number (0,1,2,3, etc.) */
continue;
            }

            // Missing hyphens are ignored             if ($i === $h) {
                $h += 4;
                --$l;
            }

            // Check characters             if (!ctype_xdigit($trimmed[$i])) {
                $this->context->buildViolation($constraint->message)
                    ->setParameter('{{ value }}', $this->formatValue($value))
                    ->setCode(Uuid::INVALID_CHARACTERS_ERROR)
                    ->addViolation();

                return;
            }
        }

        // Check length again         if (isset($trimmed[$i])) {
            

    public function isValid($value)
    {
        if (!is_string($value) && !is_int($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue($value);
        if (!ctype_xdigit((string) $value)) {
            $this->_error(self::NOT_HEX);
            return false;
        }

        return true;
    }

}
continue;
            }

            // Missing hyphens are ignored             if ($i === $h) {
                $h += 4;
                --$l;
            }

            // Check characters             if (!ctype_xdigit($trimmed[$i])) {
                $this->context->buildViolation($constraint->message)
                    ->setParameter('{{ value }}', $this->formatValue($value))
                    ->setCode(Uuid::INVALID_CHARACTERS_ERROR)
                    ->addViolation();

                return;
            }
        }

        // Check length again         if (isset($trimmed[$i])) {
            
Home | Imprint | This part of the site doesn't use cookies.