How can we determine whether a PHP variable is an instantiated object of a certain class?
- instanceof operator
- is_object() function
- is_instance() function
- class_exists() function
To determine if a PHP variable is an instantiated object of a certain class, you can use the instanceof operator. It checks if an object is an instance of a specific class or has a class in its inheritance hierarchy. Learn more: http://php.net/manual/en/language.operators.type.php
Loading...
Related Quiz
- How can you move the uploaded file to a desired directory in PHP?
- Which of the following are true about the echo statement in PHP?
- What are the PHP mail functions used for?
- What is the difference between mysqli_fetch_object() and mysqli_fetch_array()?
- You are writing a PHP script and you want to execute a block of code as long as a certain condition is true. How would you do this using a while loop?