public static function getVariables($expr)
	{
		// First, remove strings' contents to prevent false-positives
		$expr = preg_replace('/(["\']).*?\\1/s', '$1$1', $expr);

		// Capture all the variable names
		preg_match_all('/\\$(\\w+)/', $expr, $matches);

		// Dedupe and sort names
		$varNames = array_unique($matches[1]);
		sort($varNames);

		return $varNames;
	}
public static function getVariables($expr)
	{
		// First, remove strings' contents to prevent false-positives
		$expr = preg_replace('/(["\']).*?\\1/s', '$1$1', $expr);

		// Capture all the variable names
		preg_match_all('/\\$(\\w+)/', $expr, $matches);

		// Dedupe and sort names
		$varNames = array_unique($matches[1]);
		sort($varNames);

		return $varNames;
	}
public static function getVariables ( $ expr ) { // First, remove strings' contents to prevent false-positives $ expr = preg_replace ( '/(["\']).*?\\1/s' , '$1$1' , $ expr ) ; // Capture all the variable names preg_match_all ( '/\\$(\\w+)/' , $ expr , $ matches ) ; // Dedupe and sort names $ varNames = array_unique ( $ matches [ 1 ] ) ; sort ( $ varNames ) ; return $ varNames ; }
Return the list of variables used in a given XPath expression

@param  string $expr XPath expression
@return array        Alphabetically sorted list of unique variable names
Return the list of variables used in a given XPath expression