title: Use external variable inside PHP class
body: <p>I'm very new to PHP classes so forgive me if the answer is really obvious. I'm trying to figure out how to use a variable defined outside of a class inside of a class. Here is a very crude example</p>
  
  <pre><code>$myVar = 'value';
  
  class myClass {
    private $class_var = $myVar;
    //REST OF CLASS BELOW
  }
  </code></pre>
  
  <p>I know the above doesn't work, but how can I use the external $myVar inside the class?</p>