Static Variables in PHP
Table of Content:
In contrast to the variables declared as function parameters, which are destroyed on the function's exit, a static variable will not lose its value when the function exits and will still hold that value should the function be called again.
You can declare a variable to be static simply by placing the keyword STATIC in front of the variable name.
Syntax:
"; } trackerFunction(); trackerFunction(); trackerFunction(); ?>
Output:
This will produce the following result
11 12 13
we will discuss more about static
keyword later