jordanwb Posted July 31, 2008 Share Posted July 31, 2008 How would I go about checking if a class extends or implements and class or interface? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 31, 2008 Share Posted July 31, 2008 The instanceof operator works on parents and interfaces too. <?php class foo{ } class bar extends foo { } $bar = new bar; if ($bar instanceof foo) { echo "FOO!"; } else { echo "BAR!"; } ?> Echos "FOO!". Quote Link to comment Share on other sites More sharing options...
jordanwb Posted July 31, 2008 Author Share Posted July 31, 2008 Thanks. 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.