fork(1) download
  1. <?php
  2.  
  3. // your code goes here
  4. class Test {
  5.  
  6. public static $count;
  7.  
  8. public function now () {
  9. if (!$this::$count) {
  10. $this::$count = 0;
  11. }
  12. $this::$count++;
  13.  
  14. $count = (string) $this::$count;
  15.  
  16. echo 'count should be '.$count;
  17.  
  18. function tryToGetIt() {
  19. global $count;
  20. echo 'count is '.$count;
  21. }
  22. tryToGetIt();
  23. }
  24. };
  25.  
  26. $test = new Test();
  27. $test->now();
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
count should be 1count is