public static function substConstants($string) {
		preg_match_all('/\${([^}]+)}/', $string, $matches);
		
		foreach($matches[1] as $key => $match) {
			$match = trim($match);
			$search = $matches[0][$key];
			$replacement = defined($match) ? constant($match) : '';
			$string = str_replace($search, $replacement, $string);
		}
		return $string;
	}
public static function substConstants($string) {
		preg_match_all('/\${([^}]+)}/', $string, $matches);
		
		foreach($matches[1] as $key => $match) {
			$match = trim($match);
			$search = $matches[0][$key];
			$replacement = defined($match) ? constant($match) : '';
			$string = str_replace($search, $replacement, $string);
		}
		return $string;
	}
public static function substConstants ( $ string ) { preg_match_all ( '/\${([^}]+)}/' , $ string , $ matches ) ; foreach ( $ matches [ 1 ] as $ key => $ match ) { $ match = trim ( $ match ) ; $ search = $ matches [ 0 ] [ $ key ] ; $ replacement = defined ( $ match ) ? constant ( $ match ) : '' ; $ string = str_replace ( $ search , $ replacement , $ string ) ; } return $ string ; }
Performs value substitution for string options.

An option can contain PHP constants delimited by '${' and '}'.

E.g. for input string "some ${FOO} value", the method will attempt
to substitute ${FOO} with the value of constant FOO if it exists.

Therefore, if FOO is a constant, and it has value "bar", the resulting
string will be "some bar value".

If the constant is not defined, it will be replaced by an empty string,
and the resulting string will be "some  value".

@param string $string String on which to perform substitution.
@return string
Performs value substitution for string options .