fork download
  1. <?php
  2. class Class1
  3. {
  4. public $property1;
  5. public $property2;
  6.  
  7. public function __construct(array $values = $this->createArrayWithEmptyStrings())
  8. {
  9. foreach ($this as $property => $value) {
  10. $this->$property = $values[$property];
  11. }
  12. }
  13.  
  14. protected function createArrayWithEmptyStrings()
  15. {
  16. $values = array();
  17. foreach ($this as $property => $value) {
  18. $values[$this->$property] = "";
  19. }
  20. return $values;
  21. }
  22. }
  23. ?>
  24.  
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '$this' (T_VARIABLE) in /home/4SU2tm/prog.php on line 7