Re: References challenge with PHP4
| From: | Robert Cummings | Date: | Wed, 21 Mar 2007 23:40:31 +0000 |
| Subject: | Re: References challenge with PHP4 | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251055@lists.php.net to get a copy of this message | ||
On Wed, 2007-03-21 at 18:09 -0300, Martin Alterisio wrote:
>
> Actually, is not a bug, is expected behaviour and documented in the manual
>
> http://php.net/static
>
> See the last section, named "references with global and static variables"
>
> static and global are implemented internally as references, that makes
> storing references into static variables impossible (which can be solved by
> using arrays of references as seen in Robert Cummings example).
Thanks for the tip, I've never actually had to use a static var to store
an object reference, usually I use singletons and properties or my
static vars just store scalars or arrays. Good to know though, since I
didn't think to check the documented behaviour... fortunately I didn't
get around to posting a bug report either :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'