I was recently reading few articles and I learned few new things in php, which I would like to share with you all!

What are classes?

Classes are nothing but a template or blue print for an object. if you say in common language classes are nothing but noun.

So it would be not wrong to say functions would be called as verbs. Right?

Example:

class UserManager{ //This shall be the class name which is a noun.

function getUserDetails ()

//This shall be the function name which is verb.

{

function definition here

}

}

What are Objects now? (in object-oriented PHP) objects are just like the bricks used to build a building:
Objects are the building bricks of object-oriented PHP projects.

Objects in a program means - imagine there are mini programs in a bigger program.

OOPs mostly is done because of having organized code, that is the most important thing which i felt.

Advantages:
1) Re-usable blocks/code
2) Since it is in model it is easy to update aspects of your software
3) Allows many programmers on same project. Since it is segmented it allows many programmers to work on same project without fearing of breaking other users code.
4) Good for bigger project
5) Can build up personal library and reuse it in different project
6) Crucial for programmers

Disadvantage:
1) Small projects are effected because for OO we might have to write more code which would not be suitable for small projects
2) OO php can be little slower at run time.

Hope this will help!

Will like to learn from your comments!