New course! Every coder should learn Generative AI!
Try a free lesson+ 1
what if we don't write construct like in js?
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