static variable in a function
There can be a static local variable in a function that is declared only once (on the first execution of a function) and can store its value between function calls
function foo()
{
   static $numOfCalls = 0;
   
   $numOfCalls++;
   echo "this function has been executed " . $numOfCalls . " times" . PHP_EOL;
}

foo();
foo();
foo();
After executing the ebove code,
$numOfCalls
static variable gets incremented and the following text is printed:
this function has been executed 1 times
this function has been executed 2 times
this function has been executed 3 times
by Valeri Tandilashvili
4 years ago
PHP
OOP
2
Pro tip: use ```triple backticks around text``` to write in code fences