__construct() vs SameAsClassName() for constructor in PHP

后端 未结 11 2758
南笙
南笙 2020-11-28 09:55

Is there any advantage to using __construct() instead of the class\'s name for a constructor in PHP?

Example (__construct):



        
11条回答
  •  无人及你
    2020-11-28 10:14

    Forward compatibility. There's always a chance that legacy code that's left in the language for backwards compatibility's sake will be removed in a future version.

提交回复
热议问题