Reputation: 5805
It would take too long to explain why I need this, but I was wondering if there was a PHP function to check if a type of object was recognized. In other words, a function that would check if
$dog = new Dog();
would cause an error, because Dog didn't exist. Thanks for you help.
Upvotes: 0
Views: 86
Reputation: 25687
See class_exists. I think it is what you want. OR you can just wrap it with a try catch block.
Hope this helps.
Upvotes: 1
Reputation: 2181
There is a function called class_exists
For further explanation, see the PHP manual page.
http://php.net/manual/en/function.class-exists.php
Upvotes: 4