what if we don't write construct like in js? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what if we don't write construct like in js?

5th Oct 2020, 2:31 PM
Abid Adhikari
Abid Adhikari - avatar
1 Answer
+ 3
If you do not write a constructor. It automatically uses an empty constructor. So you can do this class MyClass {} $myObj = new MyClass; echo $myObj instanceof MyClass; // true
5th Oct 2020, 2:46 PM
Ore
Ore - avatar