I want to do this:
private static function parserLib() {
return USE_XML ? 'XmlParser' : 'IdfParser';
}
static function create($arr = []) {
return new ${self::parserLib()}($arr);
}
I've tried with this:
new ${'XmlParser'}($test);
Don't work.
This works:
$var = 'XmlParser';
new $var($test);
Why is not possible to use the {} to use the value retrieved from a method?