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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.