title: How to check if a construct of a class exists?
body: <p>Is there a function/method to check if a constructor exists in some class? I tried with the function_exists() method/function, but it looks like it doesn't work:</p>
  
  <pre><code>&lt;?php
  
  class Test {
  
      public function __construct() {
          echo 'Construct loaded.&lt;br /&gt;';
  
          if (function_exists('__construct'))
              echo 'Function exists.';
          else
              echo 'Function doesn\'t exists.';
      }
  
  }
  
  new Test;
  </code></pre>
  
  <p><strong>UPDATE (thanks to all, this one works):</strong></p>
  
  <pre><code>&lt;?php
  
  class Test {
  
      public function __construct() {
          echo 'Construct loaded.&lt;br /&gt;';
      }
  
  }
  
  $t = new Test;
  
  if (method_exists($t, '__construct'))
      echo 'Function exists.';
  else
      echo 'Function doesn\'t exists.';
  </code></pre>
  
  <p><strong>UPDATE #2</strong></p>
  
  <p>because i need this before i create a new object, i ended up with this piece of code (i've added it just in case someone in the future will read this):</p>
  
  <pre><code>&lt;?php
  
  class Test {
  
      public function __construct() {
          echo 'Construct loaded.&lt;br /&gt;';
      }
  
  }
  
  //$t = new Test;
  
  if (method_exists('Test', '__construct'))
      echo 'Function exists.';
  else
      echo 'Function doesn\'t exists.';
  </code></pre>