PHP Class Definition
In this chapter you will learn:
Description
In PHP we use class keyword to define a class.
Syntax
The class definition has the following syntax.
class Car {
//properties
//methods
}
Example
Here is the PHP code necessary to define a very basic Dog class:
<?PHP/*from java 2 s . com*/
class Dog {
public function bark() {
print "PHP!";
}
}
?>
Here the Dog class has just one method, bark().
Next chapter...
What you will learn in the next chapter:
Home » PHP Tutorial » PHP Class Definition