title: Global variable with private-attribute
body: <p>I have the following class:</p>
  
  <pre><code>class validationHandler{
      private $dataType; //set via constructor ...
      private $validation = null;
  
      private function requireValidation(){
          if($this-&gt;validation == null){
                $this-&gt;validation = loadDataFromJSONfile($this-&gt;dataType);
          }
      }
  
      public function validate($data){
          $this-&gt;requireValidation();
          //validate... the rules are in the $validation-variable
      }
  }
  </code></pre>
  
  <p>When an object needs to validate some data, it makes a new validation-object and calls validate().</p>
  
  <p>The first time something needs to be validated, the data is loaded from a json-file.</p>
  
  <p>But: Sometimes I have several Objects which need the same validation-file. And This code loads the file for each Object.</p>
  
  <p><strong>Question:</strong> Is there a way to set $validation global, so that every object accesses the same variable, but without loosing the private-property?</p>
  
  <p>(Notice that I have different validation-files and different kinds of objects. An objects tells the validationHanlder in __construct() which type it has, and which validation-file should be loaded. So I need $validation to be an array. <em>(Didn't write it in the code, so it's more readable)</em></p>