Home / PHP Tips Generated By ChatGPT / Preserving Variable Values with Static in PHP Maintain the value of a variable between function calls with static. Source Code function testStatic() { static $count = 0; $count++; echo $count; } testStatic(); // 1 testStatic(); // 2