fork download
  1. <?php
  2.  
  3. class Constants {
  4.  
  5. const A = 'a';
  6.  
  7. public static $A = 'a';
  8.  
  9. }
  10.  
  11. class Test {
  12. public function a($a = Constants::A) {
  13. return $a;
  14. }
  15.  
  16. public function b($b = Constants::$A) {
  17. return $b;
  18. }
  19. }
  20.  
  21. $x = new Test;
  22.  
  23. var_dump($x->a(), $x->b());
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 '$A' (T_VARIABLE), expecting identifier (T_STRING) or class (T_CLASS) in /home/KjaoNC/prog.php on line 16