PHP Static Variable with Example

Static Variables

A variable can be defined by using the ‘static’ keyword inside a function. It is the characteristic of PHP to delete the variable, once it completes its execution then the memory is released.

Example:


Result:

01

Read Also: