learning OOP in PHP

Discussion in 'PHP' started by Mike, Sep 4, 2005.

  1. Mike

    Mike New Member

    Joined:
    Oct 19, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.go4expert.com/
    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?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     
  3. Mike

    Mike New Member

    Joined:
    Oct 19, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.go4expert.com/
  4. zerofill

    zerofill New Member

    Joined:
    Oct 7, 2006
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice