fork download
  1. <?php
  2.  
  3. class Test {
  4. public static $var =1;
  5.  
  6. public static function setVar($num)
  7. {
  8. self::$var = $num;
  9. }
  10. }
  11.  
  12.  
  13. echo Test::$var;
  14.  
  15. Test::setVar(2);
  16.  
  17. echo Test::$var;
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
12