Variable Scope & Constants
Scope
PHP variables are local to functions by default. Use global $var to access global variables inside a function, or pass as parameters (preferred).
Constants
Defined with define() or const. Constants are global and cannot be changed.
Static Variables
static $count = 0 — persists between function calls.