title: How to Check for a Specific Type of Object in PHP
body: <p>I have a method which accepts a PDO object as an argument, to allow the user to use an existing connection rather then the method to open a new one, and save resources:</p>
  
  <pre><code>public static function databaseConnect($pdo = null) {
  </code></pre>
  
  <p>I am aware of <code>is_object()</code> to check if the argument is an object, but I want to check if <code>$pdo</code> is a PDO object, and not just an object.</p>
  
  <p>Because the user can easily enter (by mistake?) a different kind of object, a mysqli or such, and the entire script will break apart.</p>
  
  <p>In short: How can I check a variable for a specific type of object?</p>