I want to create a new object using this
$procedure = new ${$s.'\\'.$p};
It doesn’t work. Why isn’t this possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why don’t you
?
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 ofNamespace\Classyou 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.