get object tyhpe php 1

get object tyhpe php

gettype($obj);// Output: "object"
$obj instanceof Myclass;// Output: true (if it's an instance of that class)

Here is what the above code is Doing:
1. The first line creates a new object of the class Myclass.
2. The second line outputs the name of the class that the object belongs to.
3. The third line outputs the type of the object.
4. The fourth line checks if the object is an instance of the class Myclass.

Similar Posts