title: Use a variable from __construct() in other methods
body: <p>I defined a new variable in <code>__construct()</code> and I want to use it in another <code>function</code> of this <code>class</code>.
  But my variable is empty in the other function!</p>
  
  <p>this is my code:</p>
  
  <pre><code>class testObject{
       function __construct() {
             global $c;
             $data = array("name"=&gt;$c['name'],
                           "family"=&gt;$c['family']);
       }
  
       function showInfo() {
             global $data;
             print_r($data);
       }
  
  }
  </code></pre>