Chaining a constructor with an object function call in PHP -


Does anyone know that the following expression (PHP) of PHP is possible?

  (New A ()) - & gt; A (); // causes a syntax error  

I am very upset that someone should now write 2 rows instead of 1:

  $ c = New A (); $ C & gt; ();  

The first version is not the cause of a parse error, it is completely valid. Second, this is not really possible, but you can easily overcome this kind of problem with some coding standards.

If each team member has a signature for each defined class, and the signature of the class constructor, then you will not have another problem. Example:

  square fu {public function __ conversion ($ param) {} public function bar () {}} / ** * @tatonfu * / function fu ($ param) {new Fu ($ Ultimate); } Foo () - & gt; times ();  

Of course, you are still having problems with library code.


Comments