Classes in php

February 17, 2013
Posted by admin 2:49 PM

A class is a unit of code which contains variables and functions that describes the behavior and characteristic of all the members of a set. Normally it just a piece of code in our code that consist of methods and properties which describe the class behaviors and its characteristics

e.g. A class bike have its weight, color and speed, so the  weight and color are the variables  for this class and the speed is function for this class cause it depends on the fuel and other parameters  .A class bike can describe the behaviors   and characteristics of bike so  all the bike is member of this class.

In object-oriented programming the characteristics are the properties of the class and its behavior is known as the method of the class. The method is same as the functions in our normal programming works on parameters pass to them



class classname


public  variable name;                                                                                           //property of class

public  function  function_name(parameter,parameter2…parametern)     //method of class