Use static variable defined in function : Static : Language Basics PHP Source Code


PHP Source Code » Language Basics » Static »

 

Use static variable defined in function




 <?php
  increment ();
  increment ();
  increment ();
  function increment (){
      static $a=0;
      echo $a;
      $a++;
  }    
  ?>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Language Basics
» Static