I want to create a new object using this
$procedure = new ${$s.'\\'.$p};
It doesn't work. Why isn't this possible?
Why don't you
$name = "$s\\$p";
$procedure = new $name;
?
Also ${$s.'\\'.$p} means a variable, with a variable name that is clearly not good. If you are, and I think you are, trying to get something like an instance of Namespace\Class you should try with the code below.
I think that the {} shortcut only works with this syntax ${} which is clearly referring to a variable. So you cannot use it for instantiating new objects.
new {$s.'\\'.$p} but didn't work. If you have to use this thing so many times that you need a shortcut, maybe there's something wrong in your application.
$before{."\"is also the escape character. If you do single slash it will escape'or"of the string and will cause a parse error.