Objects are always stored by reference in any case. You don't need =& , and, as Charlotte commented, this is deprecated syntax.
Correct me if I am wrong, but I think that it creates a link to SomeClass, so we can call the new $ obj ().
No, this is not true. The new operator always creates an instance of the class, not a reference to the class as a type.
You can instantiate a variable object simply by creating a string variable with the class name and using this.
$class = "MyClass"; $obj = new $class();
Functions such as get_class () or ReflectionClass :: getName () returns the class name as a string. In PHP there is no concept of a “class reference”, as in Java.
The closest thing you think about is ReflectionClass :: newInstance () , but this is an optional way to dynamically create an object. In almost all cases, it is better to use new $class() .
source share