Re: can you get the name of an object from within it's own class?
| From: | Simon McKenna | Date: | Wed, 18 Sep 2002 04:27:49 +0000 |
| Subject: | Re: can you get the name of an object from within it's own class? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116685@lists.php.net to get a copy of this message | ||
Yeah, my brain is broke enough already,
i'll just give the class an optional 'name' property.
Thanks all!
"Will Steffen" <will@internetmedia.co.za> wrote in message
news:003101c25e34$2a049950$8000a8c0@william...
> Hehe why break your brain- give the class an id property - then you can
> have a getid method and do something like this
>
> $id = $this->getid();
> $this->fpLog = fopen("$id.log","w+");
>
> get_object_vars only seems to return properties so its not gonna help
> you.
>
> I'm currently working on an object thang as well and what ive done where
> I have whole bunch of similar objects is to chuck them into a name=value
> array as they get created so I can find them and fiddle with them again.
> I have no idea if that helps you, or if its even good coding practice
> (formal training - wots that?)
>
> hey im also a n00b so don't take my word on it - actual mileage may
> vary :-P