fork download
  1. <?php
  2.  
  3. class Base {
  4. public $alwaysSet = 1;
  5. public $notAlwaysSet;
  6.  
  7. public function __construct() {
  8. $this->notAlwaysSet = 1;
  9. }
  10. }
  11.  
  12. class Derived extends Base {
  13. public function __construct() {
  14. // do not call parent::__construct()
  15. }
  16. }
  17.  
  18. $d = new Derived;
  19. var_dump($d->alwaysSet);
  20. var_dump($d->notAlwaysSet);
  21.  
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
int(1)
NULL