title: How can I check if a object is an instance of a specific class?
body: <p>Is there a way to check if an object is an <code>SimpleXMLELement</code>?</p>
  
  <pre><code>private function output_roles($role) {
      foreach ($role as $current_role) {
          $role_ = $current_role-&gt;attributes();
          $role_type = (string) $role_-&gt;role;
          echo "&lt;tr&gt;";
          echo "&lt;td&gt;&lt;b&gt;" . $role_type . "&lt;/b&gt;&lt;/td&gt;";
          echo "&lt;/tr&gt;";
          $roles = $role-&gt;xpath('//role[@role="Administrator"]//role[not(role)]');
          if (is_array($roles)) {
              $this-&gt;output_roles($roles);
          }
      }
  }
  </code></pre>
  
  <p>This is my function and the <code>$role-&gt;xpath</code> is only possible if the provided object is a <code>SimpleXMLElement</code>. Anyone?</p>