Page 174 - CITS - Computer Software Application -TT
P. 174
COMPUTER SOFTWARE APPLICATION - CITS
In the following example $cars is an array. The PHP var_dump() function returns the data type and value:
PHP Object
Classes and objects are the two main aspects of object-oriented programming.
A class is a template for objects, and an object is an instance of a class.
When the individual objects are created, they inherit all the properties and behaviors from the class, but each
object will have different values for the properties.
Let’s assume we have a class named Car that can have properties like model, color, etc. We can define variables
like $model, $color, and so on, to hold the values of these properties.
When the individual objects (Volvo, BMW, Toyota, etc.) are created, they inherit all the properties and behaviors
from the class, but each object will have different values for the properties.
If you create a __construct() function, PHP will automatically call this function when you create an object from
a class.
PHP NULL Value
Null is a special data type which can have only one value: NULL.
A variable of data type NULL is a variable that has no value assigned to it.
161
CITS : IT&ITES - Computer Software Application - Lesson 47 - 62