public static function isExpressionNumeric($expr)
	{
		// Trim the expression and remove parentheses that are not part of a function call. PCRE
		// does not support lookbehind assertions of variable length so we have to flip the string.
		// We exclude the XPath operator "div" (flipped into "vid") to avoid false positives
		$expr = strrev(preg_replace('(\\((?!\\s*(?!vid(?!\\w))\\w))', ' ', strrev($expr)));
		$expr = str_replace(')', ' ', $expr);
		if (preg_match('(^\\s*([$@][-\\w]++|-?\\.\\d++|-?\\d++(?:\\.\\d++)?)(?>\\s*(?>[-+*]|div)\\s*(?1))++\\s*$)', $expr))
		{
			return true;
		}

		return false;
	}
public static function isExpressionNumeric($expr)
	{
		// Trim the expression and remove parentheses that are not part of a function call. PCRE
		// does not support lookbehind assertions of variable length so we have to flip the string.
		// We exclude the XPath operator "div" (flipped into "vid") to avoid false positives
		$expr = strrev(preg_replace('(\\((?!\\s*(?!vid(?!\\w))\\w))', ' ', strrev($expr)));
		$expr = str_replace(')', ' ', $expr);
		if (preg_match('(^\\s*([$@][-\\w]++|-?\\.\\d++|-?\\d++(?:\\.\\d++)?)(?>\\s*(?>[-+*]|div)\\s*(?1))++\\s*$)', $expr))
		{
			return true;
		}

		return false;
	}
public static function isExpressionNumeric ( $ expr ) { // Trim the expression and remove parentheses that are not part of a function call. PCRE // does not support lookbehind assertions of variable length so we have to flip the string. // We exclude the XPath operator "div" (flipped into "vid") to avoid false positives $ expr = strrev ( preg_replace ( '(\\((?!\\s*(?!vid(?!\\w))\\w))' , ' ' , strrev ( $ expr ) ) ) ; $ expr = str_replace ( ')' , ' ' , $ expr ) ; if ( preg_match ( '(^\\s*([$@][-\\w]++|-?\\.\\d++|-?\\d++(?:\\.\\d++)?)(?>\\s*(?>[-+*]|div)\\s*(?1))++\\s*$)' , $ expr ) ) { return true ; } return false ; }
Determine whether given XPath expression definitely evaluates to a number

@param  string $expr XPath expression
@return bool         Whether given XPath expression definitely evaluates to a number
Determine whether given XPath expression definitely evaluates to a number