Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2005
    Posts
    326

    PHP classes tutorial?

    Hi,

    I know how to do classes and all that, I did a Java class in College last year... however what I want to know is how to do some advanced classes, or good ideas/examples on how I can speed up my development that much more with classes.

    Also what do you guys use your classes for?

  2. #2
    Join Date
    Mar 2005
    Posts
    246
    I guess it depends on what you consider 'advanced' classes.

    The way I learned was downloading a MySQL class, working with it and developing a script that I needed. Taking other peoples work and learning from it is the best way when you don't have a class to go to.
    ColoCrossing - Connecting Business
    Alex Vial | avial@colocrossing.com | 1.800.518.9716

    Enterprise-Class Colo & Dedicated Servers in BUF, CHI, DFW, NYC, SJC, ATL & SEA

  3. #3
    Join Date
    Jan 2006
    Location
    Athens, Greece
    Posts
    1,481
    Grab a C book for oop. Learn about inheritance and abstraction. For me classes are not much suitable for web development, they tend to slow down overall execution time too.

  4. #4
    Join Date
    Sep 2002
    Location
    Top Secret
    Posts
    14,135
    The best place to take a look @ example php classes? http://www.phpclasses.org/ . You can download the classes, use them as examples, or whatever you like.

    There are a variety of uses for classes, such as sql connection, mail, IM, etc. Take a look through the classes listed on that website and you'll see some pretty decent uses and ways to use php classes.
    Tom Whiting, WHMCS Guru extraordinaire
    Linux problems? WHMCS Problems? Give me a shout
    Check out my WHMCS Addons

  5. #5
    Join Date
    Mar 2005
    Posts
    246
    Quote Originally Posted by Steve_Arm View Post
    For me classes are not much suitable for web development, they tend to slow down overall execution time too.
    I completely disagree, I think OOP has its place in web development. For me, classes make development go much faster, and cleaner then it would otherwise. I know that is just your opinion, so I've added mine for arguments sake
    ColoCrossing - Connecting Business
    Alex Vial | avial@colocrossing.com | 1.800.518.9716

    Enterprise-Class Colo & Dedicated Servers in BUF, CHI, DFW, NYC, SJC, ATL & SEA

  6. #6
    Join Date
    Nov 2001
    Location
    Vancouver
    Posts
    2,422
    Quote Originally Posted by Steve_Arm View Post
    Grab a C book for oop. Learn about inheritance and abstraction. For me classes are not much suitable for web development
    That's odd. Virtually every module I write is primary comprised of class definitions. I can't imagine *not* using classes. There are very few simple functions in my library; and of the few, many of these are used to construct a class instance.

    Code:
    they tend to slow down overall execution time too.
    While class instantiation has a certain amount of overhead, its generally trivial on balance unless you are instantiating many thousands of class instances on every request. That isn't often going to be the case.

    Usually time to market is more important than execution time and rarely (if ever, at least in my experience) does the overhead introduced by using classes ever cause me to have second thoughts about a particular implementation. almost always algorithm, not class instantiation, is the root problem when performance is an issue.

    Your mileage may vary.

    Or perhaps Python is just faster.
    “Even those who arrange and design shrubberies are under
    considerable economic stress at this period in history.”

  7. #7
    Join Date
    Jul 2007
    Posts
    88
    You might also take a look at the documentation on the php.net site which I have found to be a good resource though it might not be the best starting place. I know that as I have learned OOP I have had the greatest success just programming. When I got to certain points in my coding I began to understand the things that I had been reading about.
    rootbsd.net :: BSD based hosting for smart people
    FreeBSD VPS :: FreeBSD and OpenBSD Hosting Powered By Xen
    IRC: #rootbsd on freenode
    twitter: @rootbsd

Posting Permissions

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