SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: PHP Classes

  1. #1
    SitePoint Zealot forum11's Avatar
    Join Date
    Feb 2006
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Classes

    What is the use of class in PHP and defining functions under it?
    In which situation defining a class is usefull in PHP?
    Becuase we can do everything without using classes.

    Thnx
    Do Good Have Good!

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It depends which level of programming you are at. Sure, procedural coding might work fine for you at the beginning, but hey so does code with absolutely no functions

    The point is, how organized and structured your code is. Object orientation is a way of thinking about your script. It's strictly not needed, but it can really help with a lot of things. I won't go into detail here, because most likely if you were ready to take on object orientation, you wouldn't be asking. Do a bit of research on Google.

    Object orientation, in my opinion, cannot be taught by a tutorial. You can learn the syntax and the basic idea of it, and some of the most common patterns, but it's up to the programmer to expand it out at that point according to his own preferences.

  4. #4
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You use classes when you want to use object-oriented approach to PHP web development. Object-Orient makes it easy to write and resuse code. And, yes much of what you can do with OO can be done without it as well.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •