Write (new class()) ->func() in PHP

I am a novice, please skip the old bird! The first time I saw this writing method of "(new class()) ->func()" today, I can probably guess what it means, but I'm not sure. Baidu didn't find the answer, and finally I got the answer in a php communication group.

The writing of (new class()) ->func() means instantiating and calling again as follows:

 $eg = new class(); $eg -> func();

 

 

 Watson Blog
  • This article is written by Published on June 27, 2018 00:52:49
  • This article is collected and sorted by the website of Mutual Benefit, and the email address for problem feedback is: wosnnet@foxmail.com , please keep the link of this article for reprinting: https://wosn.net/1288.html
Comments: 1 of which: visitor 1 blogger 0
    •  GenZi Win
      GenZi Win one

      Abbreviated?

    Comment