title: class public variable calls compatible in PHP 7.0 and PHP 5.6
body: <p><strong>In PHP 5.6:</strong></p>
  
  <p>When being inside a class we usually declare &amp; call a public class variable like this:</p>
  
  <pre><code>class MyClass
  {
      /**
       * @var int
       */
      public $myVar = 0;
  
      // call it in a public function:
     public function myFunction()
     {
         return $this-&gt;myVar;
     }
  
  }
  </code></pre>
  
  <p>I call the function like this:</p>
  
  <pre><code>MyClass::myFunction();
  </code></pre>
  
  <p><strong>In PHP 7.0 that code throws a fatal error:</strong> </p>
  
  <blockquote>
    <p>Using $this when not in object context</p>
  </blockquote>
  
  <p>After changing my PHP version back to 5.6 again, the error was gone.</p>
  
  <p><strong>Questions:</strong></p>
  
  <p><em>I have to admit that after reading the manual and changes from 5.6 to 7.0 I don't get it.</em></p>
  
  <ol>
  <li>How do we declare and call public class variables in PHP 7.0?</li>
  <li>How do we write this code to be compatible between 5.6 and 7.0?</li>
  </ol>
  
  <p><strong>Edit after comments:</strong></p>
  
  <p>So why then a static call on a non static method works in 5.6?</p>