Examveda
Examveda

What will be the output of the following PHP code?
<?php
class MyClass
{
}
 
$a = new MyClass;
var_dump(!($a instanceof stdClass));
?>

A. bool(true)

B. bool(false)

C. error

D. none of the above

Answer: Option A

Solution(By Examveda Team)

To check if an object is not an instanceof a class, the logical not operator can be used.

This Question Belongs to PHP >> Object Oriented Concept

Join The Discussion

Related Questions on Object Oriented Concept