what is a PHP Class?

Discussion in 'PHP' started by olddocks, Oct 12, 2007.

  1. #1
    I have never used php classes and object with it. All i know is writing functions and have always used simple php code.

    Is there any good reason for me to use a php class?
     
    olddocks, Oct 12, 2007 IP
  2. wizardgp

    wizardgp Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yes to object oriented programing which is 100 times secure
     
    wizardgp, Oct 12, 2007 IP
  3. Squash

    Squash Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This depends from your project. If you need simple script or simple website - so you can easy use only functions and be happy. If you want to develop really complex website, or use any PHP framework - you must learn Object Oriented Programming on PHP.

    You can read detailed about classes here
    http://www.php.net/manual/en/language.oop5.php
     
    Squash, Oct 12, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Classes are not more secure. It all depends on the way you write them. Same for normal code.
     
    nico_swd, Oct 12, 2007 IP
  5. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #5
    I heard that classes can be fast for complex code. Is it true?
     
    olddocks, Oct 12, 2007 IP
  6. Vizuke

    Vizuke Peon

    Messages:
    339
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    making classes allows easy migration to other projects.
     
    Vizuke, Oct 12, 2007 IP
  7. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yes. OOP allows you to more easily reuse and organize code. Learning classes expands your abilities as a coder.

    Yes, but so can procedural coding; It just depends how you are doing it. The primary reason for OOP is to keep your code organized and reusable. Classes are useful when working on a project with multiple developers as well.

    There is a lot you can do with classes, so I recommend learning them well, especially if you ever intend to use a framework.
     
    Gordaen, Oct 12, 2007 IP
  8. Jonny`

    Jonny` Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    To be very very simple. A class is a group of a load of functions. I learnt OOP a while back while writing a custom CMS. Well worth it.
     
    Jonny`, Oct 13, 2007 IP
  9. Phaaze

    Phaaze Member

    Messages:
    51
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #9
    All of the big CMS systems and stuff you'll see around the net are OOP and built around classes.. These forums (vBulletin) being a perfect example..
     
    Phaaze, Oct 13, 2007 IP