Variable scope: function : Variable Scope « Language Basics « PHP






Variable scope: function

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

           
       








Related examples in the same category

1.Use variable defined outside function
2.Scope of a Variable
3.Variable Scope: A Variable Declared Within a Function Is Unavailable Outside the Function
4.Variables Defined Outside Functions Are Inaccessible from Within a Function by Default
5.Defining Variable Scope
6.More Working with Variable Scope
7.local variables
8.Variable Scope
9.Variable Scope in Functions
10.Variable Scope: A Variable Declared Within a Function Is Unavailable Outside the Function