Check if the string is in numeric

@param string $str
@return bool

@throws \ErrorException
972731
public static function isNumeric($str)
    {
        if (!is_string($str)) {
            throw new \ErrorException('Accept string ' . gettype($str) . ' given');
        }

        return  (bool) preg_match('/^[0-9]+(\.[0-9]+)?$/', $str);
    }
464012
public function isValid($value)
    {
        if (!is_string($value) && !is_int($value) && !is_float($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        if (is_int($value)) {
            return true;
        }

        $this->_setValue($value);
        if ($this->_locale === null) {
            $locale        = localeconv();
            $valueFiltered = str_replace($locale['decimal_point'], '.', $value);
            $valueFiltered = str_replace($locale['thousands_sep'], '', $valueFiltered);

            if (strval(intval($valueFiltered)) != $valueFiltered) {
                $this->_error(self::NOT_INT);
                return false;
            }

        } else {
            try {
                if (!Zend_Locale_Format::isInteger($value, array('locale' => $this->_locale))) {
                    $this->_error(self::NOT_INT);
                    return false;
                }
            } catch (Zend_Locale_Exception $e) {
                $this->_error(self::NOT_INT);
                return false;
            }
        }

        return true;
    }
132892
def is_numeric(self, value, strict=False):
        """"""
        value = stringify(value)
        if value is not None:
            if value.isnumeric():
                return
        self.shout('value %r is not numeric', strict, value)
424258
public static function isBase64Encoded($str)
	{
		$debug = \bdk\Debug::getInstance();
		return $debug->utilities->isBase64Encoded($str);
	}
412938
public function in_range($str, $field)
    {
        $_range = explode('-', $field);
        $_low   = isset($_range[0]) ? (float) $_range[0] : null;
        $_high  = isset($_range[1]) ? (float) $_range[1] : null;

        if (is_null($_low) || is_null($_high)) {
            return true;
        }

        if ((float) $str >= $_low && (float) $str <= $_high) {

            return true;

        } else {

            if (!array_key_exists('in_range', $this->_error_messages)) {
                $this->set_message('in_range', lang('fv_in_range_field'));
            }

            return false;
        }
    }
785074
public function isValid ($value)
    {
        if (!is_numeric($value)) {
            $this->error(self::INVALID);
            return false;
        }

        if (!preg_match('/^-?[0-9]+([.,][0-9]+)?$/', $value)) {
            $this->error(self::INVALID);
            return false;
        }

        return true;
    }
98337
public static function int($str)
    {
        if(is_array($str)){
            foreach($str as $key=>$val){
                $str[$key] = self::int($val);
            }
            return $str;
        }
        return preg_replace('/[^0-9]/', '', $str);
    }
1058883
private function check($value) {

		if(true === is_string($value) || is_numeric($value)) {

			if(true === $this -> strict) {
				return true === is_int($value);
			}

			return !in_array(preg_match('/^-?[0-9]+$/', $value), [false, 0]);
		}

		return false;
	}
1005255
private function MaxAge($str) {
    if (strpos($str, '.') === false) {
      throw new Exception('File has no extension');
    }
    $str = strrchr($str, '.');
    $str = substr($str, 1);
    return (integer) $str;
  }
597347
private static function parseString($str)
    {
        if ($str[0] !== '"' || $str[strlen($str) - 1] !== '"') {
            throw new Exception("Invalid string delimiters");
        }

        $result = '';
        $start = str_split(substr($str, 1, -1), 1);
        $escaped = false;
        $data = null;

        foreach ($start as $chr) {
            if ($escaped === 'yes') {
                $escaped = false;
                switch ($chr) {
                    case 'n':  $result .= "\n"; break;
                    case 'r':  $result .= "\r"; break;
                    case 't':  $result .= "\t"; break;
                    case 'v':  $result .= "\v"; break;
                    case 'e':  $result .= "\e"; break;
                    case 'f':  $result .= "\f"; break;
                    case '\\': $result .= "\\"; break;
                    case '$':  $result .= "\$"; break;
                    case '"':  $result .= "\""; break;
                    case 'x':
                        $escaped = 'hex';
                        $data = '0x';
                        break;
                    default:
                        if (ctype_digit($chr) && (int)$chr < 8) {
                            $escaped = 'oct';
                            $data = $chr;
                        } else {
                            $result .= "\\" . $chr;
                        }
                        break;
                }
            } else if ($escaped === 'hex' && ctype_xdigit($chr)) {
                $data .= $chr;
                if (strlen($data) === 2) {
                    $escaped = false;
                }
            } else if ($escaped === 'oct' && ctype_digit($chr) && (int)$chr < 8) {
                $data .= $chr;
                if (strlen($data) === 3) {
                    $escaped = false;
                }
            } else {
                if ($data !== null || $escaped === 'hex' || $escaped === 'oct') {
                    if (substr($data, 0, 2) === '0x') {
                        if (strlen($data) === 2) {
                            $result .= "\\x";
                        } else {
                            $result .= chr(hexdec($data));
                        }
                    } else {
                        $result .= chr(octdec($data));
                    }
                    $data = null;
                }

                if ($chr === '\\') {
                    $escaped = 'yes';
                } else if ($chr === '"') {
                    throw new Exception("Unescaped string delimiter inside string");
                } else {
                    $result .= $chr;
                }
            }
        }
        if ($escaped !== false) {
            throw new Exception("Unfinished escape sequence");
        }
        return $result;
    }
255192
private function check($value, $params) {

		if(true === is_string($value) || is_numeric($value)) {
			return strlen($value) >= (int) $params[0];
		}

		return false;
	}
224323
public function isEncoded($str) {
		$this->decoded = $this->_decode($str);

		if ($this->decoded !== false) {
			return true;
		}
		return false;
	}
562273
static function is_utf8($str)
    {
        $c=0; $b=0;
        $bits=0;
        $len=strlen($str);
        for($i=0; $i<$len; $i++)
        {
            $c=ord($str[$i]);
            if($c > 128)
            {
                if(($c >= 254)) return false;
                elseif($c >= 252) $bits=6;
                elseif($c >= 248) $bits=5;
                elseif($c >= 240) $bits=4;
                elseif($c >= 224) $bits=3;
                elseif($c >= 192) $bits=2;
                else return false;
                if(($i+$bits) > $len) return false;
                while($bits > 1)
                {
                    $i++;
                    $b=ord($str[$i]);
                    if($b < 128 || $b > 191) return false;
                    $bits--;
                }
            }
        }
        return true;
    }
872224
private function validateFloat(string $str) : float
    {
        $ret = filter_var($str,FILTER_VALIDATE_FLOAT);
        if ($ret === false){
            throw new CompileErrorException('invalid float value', $this->state);
        }
        return $ret;
    }
1050595
public static function validate($value)
    {
        if (!is_numeric($value)) {
            return false;
        }

        $stringLength = strlen($value);

        if ($stringLength !== 9 && $stringLength !== 8) {
            return false;
        }

        $sum = 0;
        $multiplier = $stringLength;
        for ($counter = 0; $counter < $stringLength; $counter++, $multiplier--) {
            if ($multiplier == 1) {
                $multiplier = -1;
            }

            $sum += substr($value, $counter, 1) * $multiplier;
        }

        return $sum % 11 === 0;
    }
334732
public static function IS_NUMBER($value = NULL) {
		$value		= self::flattenSingleValue($value);

		if (is_string($value)) {
			return False;
		}
		return is_numeric($value);
	}
339386
static function IsValidMod10($str)
	{
	   if (strspn($str, "0123456789") != strlen($str))
	   {
	      return false;
	   }

	   $map = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // for even indices
	                0, 2, 4, 6, 8, 1, 3, 5, 7, 9); // for odd indices
	   $sum = 0;
	   $last = strlen($str) - 1;

	   for ($i = 0; $i <= $last; $i++)
	   {
	      $sum += $map[$str[$last - $i] + ($i & 1) * 10];
	   }

	   return $sum % 10 == 0;
	}