Home |

Advanced JavaScript and Dojo course: PHP variable Scope

Function 1: Function one: Global scope does not exist
Function 1a: Function one: 1 Global scope may be declared
Function 2: Function two: 2 Local scope
Function 3: Function three: 3 Local scope again (Note: global var. 3 remain unchanged)
Function 4: Function four: 4 There is no block scope in PHP
Function 5: Object properties (this.a=5) does not exist the same way in PHP!
Function 6..8: PHP may achive the same thing by using class and extend..
Control global var: 1