$var is set to 1; a function sets $var to 2.
Because $var is a local variable within the function, even if they have the same name, they still have two separate values.
$var is set to 1; a function calls global before $var, then sets it to 2.
Because global was called in the function, it used $var as a global variable instead of a local variable, therefore changing the value of the variable outside of the function.
$var is set to 1; a function creates another $var, but sets it as static and its value to 2; $var is incremented at the end of the function.
Because the function made its local variable $var static, its value was incremented upon each call, despite it being set to 2 at the beginning. The global $var is unaffected.