Is it possible to instantiate a class from a string, without declaring another variable before ?
It's usually done writing
$className = 'myClass'
$instance = new $className();
but it could be handy to have it shorter like for example
$instance = new ${'className'}();
The purpose is to have objects created (under condition) inside a loop without use of extra vars...
Edit : $className is dynamic, it is hard coded above to explain the situation
eval. Why do you have the 'no extra vars' constraint?$instance = new classname();anyway. If you know the class name beforehand, you can hard code it; if you don't, it will already be in a variable. Perhaps you can expand your question further to explain your needs more clearly.'className'string, why can't you just donew className()