Guest User

Untitled

a guest
Oct 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. edward@vds1:~$ cat /home/edward/test.static.php
  2. <?php
  3.  
  4. test(1,2);
  5. test(3,2);
  6. test(1,5);
  7. test(90,15);
  8.  
  9. function test($a,$b) {
  10. static $foo = array();
  11. $foo[$a] = $b;
  12. print_r($foo);
  13. }
  14.  
  15. ?>
  16. edward@vds1:~$ php /home/edward/test.static.php
  17. Array
  18. (
  19. [1] => 2
  20. )
  21. Array
  22. (
  23. [1] => 2
  24. [3] => 2
  25. )
  26. Array
  27. (
  28. [1] => 5
  29. [3] => 2
  30. )
  31. Array
  32. (
  33. [1] => 5
  34. [3] => 2
  35. [90] => 15
  36. )
Add Comment
Please, Sign In to add comment