PHP class

Class is a core concept of PHP Object Oriented Programming. We can say that class is a template for an object and object is an instance of a class. We use object and instance as the same thing. For  example, Human class, Bycicle class etc.

The General Form of a class

We use class keyword to define a class. So we can define PHP class by following way

class classname{
//Object state
// Object bahavior
}

A PHP class body is  enclosed by curly braces.

PHP class naming convention

Class body surrounded by curly braces {}
Class name starts with capital letter(It is not necessary but we use this convention in our tutorial)
We write all methods and variable within class.

Comments

Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Homebrew uninstall