title: How to get instance of a specific class in PHP?
body: <p>I need to check if there <strong>exists</strong> an instance of <code>class_A</code> ,and if there <strong>does exist</strong>, <strong>get</strong> that instance.</p>
  
  <p>How to do it in PHP?</p>
  
  <p>As always, I think a simple example is best.</p>
  
  <p><strong>Now</strong> my problem has become:</p>
  
  <pre><code>$ins = new class_A();
  </code></pre>
  
  <p>How to store the instance in a static member variable of <code>class_A</code> when instantiating?</p>
  
  <p>It'll be better if the instance can be stored when calling <code>__construct()</code>. Say, it should work without limitation on how it's instantiated.</p>