Jessica Posted January 22, 2008 Share Posted January 22, 2008 Since this gives an unexpected ! error: if($section !instanceOf Section){ } I keep doing this: if($section instanceOf Section){ //do nada. }else{ $this->getSection(); } Is there another way to check if something is not an instanceOf? Am I missing something basic here? Link to comment https://forums.phpfreaks.com/topic/87165-not-instance-of-syntax/ Share on other sites More sharing options...
toplay Posted January 22, 2008 Share Posted January 22, 2008 I've never had the need to use "instanceof" yet, however, I would imagine it would work this way instead: if (!$section instanceOf Section) { } Or: $bolInstance = ($section instanceOf Section); if (!$bolInstance) { } FYI: is_a() is deprecated as of PHP 5. Link to comment https://forums.phpfreaks.com/topic/87165-not-instance-of-syntax/#findComment-445808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.