Welcome to WebmasterWorld Guest from 54.161.25.213

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php oop

     

Lolalola

8:43 pm on Jun 1, 2010 (gmt 0)

Inactive Member
Account Expired

 
 



Hi,

On this site I found a lot of cool examples of PHP OOP. Maybe you know where to find complete examples? Guest books, registration forms, blog...

When I look at the full model is much easier to understand OOP PHP. As different classes interacting with each other, exchange data How to use the generic class for sending data to the database

Thanks
9:08 pm on June 1, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 29, 2008
posts: 65
votes: 0


Hi,

You might be better off trying out a PHP framework like Cake, Symphony or Zend.
2:42 am on June 3, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2003
posts:748
votes: 0


The book PHP 5 Objects, Patterns, and Practice by Matt Zandstra was something I found quite useful.
11:42 am on June 3, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:July 8, 2008
posts: 80
votes: 0


class One {
function one_func(){
return 'hello';
}

}

class Two {
function two_func(){
return 'world';
}
}

//to access the functions of the above classes assuming they r on the same page
$one = new One();
$two = new Two();
print $one->one_func().' '.$two->two_func();
12:06 pm on June 3, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 22, 2009
posts:1396
votes: 0


Hi there Lolalola,

I too am just starting to learn OOP, and am finding it quite alot of fun, especially when it works. For places of reference php.net is the best place as a start point - but we all have our different ways of learning. I started php years ago, and decided to learn OOP when I had got the hang of just writing a script, and honing it to function better so that the background experience would pay off when trying a new way of structuring a site. I'm glad I made that choice.

One thing to be wary of is the differences between the PHP4 and PHP5 class engine/structure, as this has caught me out a few times in the last day or two.

My advice: Start with something simple, learn how things are structured, and see how they interact - see what happens when you change var types etc - this is how I have gone about it.

There are a few decent books out, just depends on how much you are willing to pay.

Have fun with whatever you decide to go with.

Good luck!

Cheers,
MRb