daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. class Counter{
  3.  
  4. public static $v;
  5.  
  6. public function add(){
  7. self::$v++;
  8. }
  9.  
  10. public function get(){
  11. return self::$v;
  12. }
  13. }
  14.  
  15. $a = new Counter();
  16. $a->add();
  17. $a->add();
  18.  
  19. echo $a->get();
  20.  
  21. $b = new Counter();
  22. $b->add();
  23. echo $b->get();
  24.  
  25. die;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top