Using functions avoids the need to copy or rewrite similar code sections many times over by combining sets of statements together so that they can be called by a simple name.
By default, a function can return a single value. But by utilizing arrays, references, and global variables, any number of values can be returned.
When you reference a variable by name, such as by assigning its value to another variable or by passing its value to a function, its value is copied. The original does not change when the copy is changed. But if you reference a variable, only a pointer (or reference) to its value is used, so that a single value is referenced by more than one name. Changing the value of the reference will change the original as well.
Scope refers to which parts of a program can access a variable. For example, a variable of global scope can be accessed by all parts of a PHP program.
To incorporate one file within another, you can use the
require directives, or their safer variants,
A function is a set of statements referenced by a name that can receive and return values. An object may contain zero, one, or many functions (which are then called methods) as well as variables (which are called properties), all combined in a single unit.
To create a new object in PHP, use the
new keyword like this:
$object = new Class.
To create a subclass, use the
extends keyword with syntax such as this:
class Subclass extends
To call a ...