Sunday, June 2, 2013

Variable and Variable Scope

Variables:
Variables are used for storing a values, like text strings, numbers or arrays. When a variable is declared, it can be used over and over again in your script. All variables in PHP start with a ‘$’sign symbol.

Basic PHP Constructs


A construct is just short for control structure. Unlike an expression the construct creates a flow of control in the code. The construct controls how or when statements are executed, in order to create a structure of code that effectively tackles the task the programmer aims to achieve. Think of constructs like a place where code gets directed (or literally constructed) during execution. Imagine a busy intersection where lots of cars need to pass through. A construct is like a traffic light that directs how the traffic flows so that there isn’t an accident.