title: In PHP how can i check if class exists?
body: <p>So i have this kind of struct function in main class</p>
  
  <pre><code>function __construct(){
      $this-&gt;conf = $GLOBALS['conf'];
      $this-&gt;dbi = new dbinfo;
      $this-&gt;modOpt = new modOptions;
      $this-&gt;lang = new language;
  
      /** Connect DB extended Class **/
      parent::__construct($GLOBALS['connect']);
  }
  </code></pre>
  
  <p>where i define classes, but this classes is into library file which is included at the start of file except one, which is included when post request will appear like this:</p>
  
  <pre><code>if (isset($_POST['delGroup']) &amp;&amp; isset($_SESSION['content_viewer']) &amp;&amp; $_SESSION['content_viewer']['code'] &gt;= 1){   
      include_once(realpath(dirname(__FILE__) . '/../..')."/mod/dbinfo/proc.php");
  }
  </code></pre>
  
  <p>so i want add check into my construct function for dbinfo class like this</p>
  
  <pre><code>function __construct(){
      $this-&gt;conf = $GLOBALS['conf'];
      if (isset(new dbinfo))
          $this-&gt;dbi = new dbinfo;
  
      $this-&gt;modOpt = new modOptions;
      $this-&gt;lang = new language;
  
      /** Connect DB extended Class **/
      parent::__construct($GLOBALS['connect']);
  }
  </code></pre>
  
  <p>but this method with <code>if isset</code> does not works, please show me correct way how to check if class exists into file. thanks</p>