Is there any difference between the object created by PHP `$a = new A ();` and `$a = new A;`?

class A{
    function say(){
        print "a";
    }
}

$a = new A();
$a->say();

is there any difference between the creation object $a = new A (); and $a = new A; here?

Php
Mar.24,2021

is written differently. If the constructor needs to pass parameters, use the first one!


makes no difference. Objects are instantiated in the form of no parameters.


there is no difference:


Thank you for the invitation. If so many people answer, there is no need to answer!

Menu