learning OOP in PHP

Mike's Avatar
Go4Expert Member
Hi,

This post is not meant to flame OOP'ers.

I'm trying to learn OOP (PHP4), but I'm having a hard time getting why OOP is more reusable than my procedual functions.

I use a "functions.php" file where I have stashed all my functions, connect to db, resize an image... and so on.

How would i write the following code using OOP, and make it more reusable?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
All Database related to one class, image related in other class. mail related in other ... This way you can use some of the existing classes to gain more stability.
0
Mike's Avatar
Go4Expert Member
Thanks
0
zerofill's Avatar, Join Date: Oct 2006
Light Poster
Quote:
Originally Posted by shabbir
All Database related to one class, image related in other class. mail related in other ... This way you can use some of the existing classes to gain more stability.
Well there is also those but you also have to know OOP is much cleaner aswell as it is much easier to develop upon, if for example you have 2-3 people working on your site you can ask them to make classes and function and from there you can grab those functions within the classes to do some process.

OOP is much easier to understand and also everything is centralised.