protected function isConstantExpression($expr)
	{
		// Replace strings to avoid false-positives
		$expr = preg_replace('("[^"]*"|\'[^\']*\')', '0', $expr);

		// Match function calls against the list of supported functions
		preg_match_all('(\\w[-\\w]+(?=\\())', $expr, $m);
		if (count(array_diff($m[0], $this->supportedFunctions)) > 0)
		{
			return false;
		}

		// Match unsupported characters and keywords, as well as function calls without arguments
		return !preg_match('([^\\s\\-0-9a-z\\(-.]|\\.(?![0-9])|\\b[-a-z](?![-\\w]+\\()|\\(\\s*\\))i', $expr);
	}
protected function isConstantExpression($expr)
	{
		// Replace strings to avoid false-positives
		$expr = preg_replace('("[^"]*"|\'[^\']*\')', '0', $expr);

		// Match function calls against the list of supported functions
		preg_match_all('(\\w[-\\w]+(?=\\())', $expr, $m);
		if (count(array_diff($m[0], $this->supportedFunctions)) > 0)
		{
			return false;
		}

		// Match unsupported characters and keywords, as well as function calls without arguments
		return !preg_match('([^\\s\\-0-9a-z\\(-.]|\\.(?![0-9])|\\b[-a-z](?![-\\w]+\\()|\\(\\s*\\))i', $expr);
	}
protected function isConstantExpression ( $ expr ) { // Replace strings to avoid false-positives $ expr = preg_replace ( '("[^"]*"|\'[^\']*\')' , '0' , $ expr ) ; // Match function calls against the list of supported functions preg_match_all ( '(\\w[-\\w]+(?=\\())' , $ expr , $ m ) ; if ( count ( array_diff ( $ m [ 0 ] , $ this -> supportedFunctions ) ) > 0 ) { return false ; } // Match unsupported characters and keywords, as well as function calls without arguments return ! preg_match ( '([^\\s\\-0-9a-z\\(-.]|\\.(?![0-9])|\\b[-a-z](?![-\\w]+\\()|\\(\\s*\\))i' , $ expr ) ; }
Test whether given expression seems to be constant

@param  string $expr
@return bool
Test whether given expression seems to be constant