title: PHP - Assigning class constant value to property in constructor
body: <p>I have been trying to create a simple class, which defines default property values as class constants at the top of the class definition.</p>
  
  <p>However, my code does not seem to be assigning the value of the constant to the property in the constructor.</p>
  
  <pre><code>class Tester {
      const DEFAULT_VAL = 500;
  
      private $val;
  
      public function __construct() {
          $val = self::DEFAULT_VAL;
      }
  
      public function show_val() {
          echo "DEFAULT_VAL is " . self::DEFAULT_VAL . "&lt;br /&gt;";
          echo "val is " . $val;
      }
  }
  
  $obj = new Tester();
  $obj-&gt;show_val();
  </code></pre>
  
  <p>Running the code above yields the result:</p>
  
  <pre><code>const is 500
  val is 
  </code></pre>
  
  <p>I cannot figure out why I cannot assign the predefined, constant default value to the property from within the constructor.</p>