Posted By

anagaiyahoocom on 07/12/11


Tagged


Versions (?)

Static test


 / Published in: JavaScript
 

Set and read static property

  1. class TestIt {
  2.  
  3. public static $loaded=false;
  4.  
  5. function doit() {
  6.  
  7. if(self::$loaded===false)
  8. {
  9. echo 'loading<br>';
  10. self::$loaded = true;
  11.  
  12. }
  13. else {
  14. echo 'loaded: '.self::$loaded.'<Br>';
  15. self::$loaded=false;
  16.  
  17. }
  18. /*
  19. if(self::$loaded=='true')
  20. {
  21. echo 'loaded: '.self::$loaded.'<Br>';
  22. self::$loaded='false';
  23. echo 'new: '.self::$loaded;
  24. }
  25. else {
  26. echo 'loading<br>';
  27. self::$loaded = 'true';
  28. }
  29. */
  30. }
  31. }
  32.  
  33.  
  34. TestIt::doit(); //display loading
  35. TestIt::doit(); //display loaded

Report this snippet  

You need to login to post a comment.