Collaborative Information Site


Properties and Methods in PHP

posted by infokita 8 months ago
tags: php programming

Properties and Methods in PHP - Each class has properties that are sometimes called attributes. Properties of a car such as color, size, price and so on. In the class, properties are represented by a variable. For example $color, $price, and so on. Method is something that can be done by object. The method in PHP is synonymous with a function. Methods that may belong to a car for example, methods to turn the car, run the car, stop the car, and so forth. Naming properties and methods have the same rules as naming a variable or function. However, based on the convention, naming properties and methods must use camel caps, where each word begins with uppercase except the first word, each word is combined with no spaces or under-scores(_).

Properties and Methods in PHP Adding Properties (Variables) Consider the example of defining the class and its properties, as follows: class Car{ var $color; var $brand; var $price; // Add method definitions here} The class variable can also be directly initialized with a value. Ho continue reading
5 visits |0 Comments

PHP Include Function

posted by ontimeitsolution 1 year ago
tags: PHP Include Function

The PHP include function is very helpful because it comprises the contents of another file which placed in another location.

continue reading
6 visits |0 Comments