Re: [PHP4BETA] Session: objects containing objects
| From: | Andreas Pour | Date: | Fri, 25 Feb 2000 20:18:49 +0000 |
| Subject: | Re: [PHP4BETA] Session: objects containing objects | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10995@lists.php.net to get a copy of this message | ||
Kristian Köhntopp wrote:
>
> thies@digicol.de wrote:
> > > - PHP4's serializer is at least en par with the PHPLIB
> > > serializer, obsoleting the Session class in PHPLIB.
> >
> > it's been like this since before the user-group meeting in
> > hamburg.
>
> I know, but I have not been following this list and
> Ulf did not ask. I wrote the above to stop this
> thread.
>
> The only remaining question is: It is officially legal
> to reset($o); and list($k, $v) = each($o) with $o being
> an object. If so, there is no pressing need to have a
> function returning the slots of an object.
I'm not sure, but you can always use:
$a = (array) $o;
for (reset($a); list($k, $v) = each($a); )
. . .
Works w/ PHP3 & 4.
> I'd like to have such a function, though, and be able
> to use it on a class as well as on an object, with the
> function returning the defined slots of a class and their
> defaults (if present) when used on a class
you can get the defined slots by walking through the keys in the above
example. To get default values I guess you would have to instantiate
the class and walk through it.
Ciao,
Andreas