Scope can be defined as the range of availability a variable has to the program in which it is declared. PHP variables can be one of four scope types:
- Local variables
- Function parameters
- Global variables
- Static variables
NOTE: PHP Functions are covered in detail in PHP Function Chapter.
But in short a function is a small unit of program which can take some input in the form of parameters and does some processing and may return a some value.
Function Parameters:
Function parameters are declared after the function name and inside parentheses. They are declared much like a typical variable would be:
<? |
This will produce following result.
Return value is 100 |
