isNumber example


    public static function getNumber($input, array $options = array())
    {
        $options = self::_checkOptions($options) + self::$_options;
        if (!is_string($input)) {
            return $input;
        }

        if (!self::isNumber($input$options)) {
            throw new Zend_Locale_Exception('No localized value in ' . $input . ' found, or the given number does not match the localized format');
        }

        // Get correct signs for this locale         $symbols = Zend_Locale_Data::getList($options['locale'],'symbols');
        // Change locale input to be default number         if ((strpos($input$symbols['minus']) !== false) ||
            (strpos($input, '-') !== false)) {
            $input = strtr($input, array($symbols['minus'] => '', '-' => ''));
            $input = '-' . $input;
        }

        
$result = new Node\NegationNode($result$argument);
                } else {
                    $arguments = [];
                    $next = null;

                    while (true) {
                        $stream->skipWhitespace();
                        $next = $stream->getNext();

                        if ($next->isIdentifier()
                            || $next->isString()
                            || $next->isNumber()
                            || $next->isDelimiter(['+', '-'])
                        ) {
                            $arguments[] = $next;
                        } elseif ($next->isDelimiter([')'])) {
                            break;
                        } else {
                            throw SyntaxErrorException::unexpectedToken('an argument', $next);
                        }
                    }

                    if (!$arguments) {
                        
/** * Defined by Zend_Filter_Interface * * Normalizes the given input * * @param string $value Value to normalized * @return string|array The normalized value */
    public function filter($value)
    {
        if (Zend_Locale_Format::isNumber($value$this->_options)) {
            return Zend_Locale_Format::getNumber($value$this->_options);
        } else if (($this->_options['date_format'] === null) && (strpos($value, ':') !== false)) {
            // Special case, no date format specified, detect time input             return Zend_Locale_Format::getTime($value$this->_options);
        } else if (Zend_Locale_Format::checkDateFormat($value$this->_options)) {
            // Detect date or time input             return Zend_Locale_Format::getDate($value$this->_options);
        }

        return $value;
    }
}
Home | Imprint | This part of the site doesn't use cookies.