Hello,

I've tried searching it (subject) in Google but I end up in book reviews which quite not what I wanted...

Can you share links that lead to topics about hands-on exercises on PHP classes and objects? Just like in the end-part of every chapter in a programming book, the author provides exercises to readers for them to apply their newly
acquired knowledge.

Thanks.

    I'm not sure too many object books will have "exercises" you are expecting. The ones I've read walk you through scenarios that objects can be used in. Reason for this being that objects aren't really something that you implement once and that's the only way to use it. Objects typically adhere to patterns of some kind and good OO code can really be portable.

    A good book to read is PHP Objects, Patterns and Practice by Matt Zandstra. Really that's the only good book I know of which really delves deep into Objects in PHP (although it does extrapolate into other languages).

    Sorry I don't know of any exercises with objects that you can show you how they work, or give you practice. All I can say is take a piece of code (like user information, database interaction, session information, etc.) and create a class (or set of classes (abstract / interface / factory / etc.)) which does what you need it to. No class is all encompassing. No class will fit every scenario; however, you can create a base class which can be used in multiple scenarios 🙂

      Sorry for the delayed response..anyway thanks for all your replies and I will be surely reading those links you've provided.

      @:

      Actually, I thinking of a scenario where I am considering my self taking a pre-qualifying technical examination for a job position, let us say, PHP Developer, where a problem(s) or output(s) is given then I am required to formulate classes that will solve the said problem or produce the expected output. I hope I am making sense. 🙂

        Write a Reply...