Re: Re: classes v. functions
| From: | olinux | Date: | Sat, 19 Jul 2003 18:36:23 +0000 |
| Subject: | Re: Re: classes v. functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155908@lists.php.net to get a copy of this message | ||
I'm quite new to OOP myself, but these two articles
helped my understanding a lot
See the sidebar - Classes and Object Oriented
Programming
http://webreference.com/perl/xhoo/php1/5.html
Taking PHP the OO way
http://phpmag.net/itr/online_artikel/psecom,id,284,nodeid,114.html
olinux
--- Sam Baum <idsam@gmx.de> wrote:
> Hi,
>
> am Friday 18 July 2003 23:08 schrieb Andu:
>
> > This may show my ignorance or my refusal to take
> for granted something I
> > don't fully understand but I have a hard time
> figuring out the advantage
> > of using classes as opposed to just functions. I
> am certainly new to php
> > and at first sight classes seemed to cut a lot of
> corners but so do
> > functions (with which I have more experience). The
> more I read about
> > classes the deeper the confusion. Anyone can
> enlighten me?
>
> Im programming for a few years now in PHP. After
> trying to use classes i
> dont see their point either. In most cases if i need
> a class-like structure
> i do something like this:
>
> function thing_new() {
> return ++$GLOBALS['thing_resource'];
> }
>
> function thing_put($stuff, $res=NULL) {
> if (is_null($res)) $res =
> $GLOBALS['thing_resource'];
> $GLOBALS['thing_stuff'][$res] = $stuff;
> }
>
> function thing_get($stuff, $res=NULL) {
> if (is_null($res)) $res =
> $GLOBALS['thing_resource'];
> return $GLOBALS['thing_stuff'][$res];
> }
>
> Because there is no constraint to be more OO like in
> Java it doesnt makes
> sense. And this way you are more flexible.
>
>
> bg
>
> Sam
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com