Re: Static properties

From: Date: Tue, 25 Apr 2006 13:02:39 +0000
Subject: Re: Static properties
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-22956@lists.php.net to get a copy of this message
On Tuesday 25 April 2006 14:30, Edin Kadribasic wrote: > Hi, > > I was wondering if someone could enlighten me why it is not possible to > create on-the-fly static properties: > > php -r 'class foo{}; foo::$bar = 1;' > Fatal error: Access to undeclared static property: foo::$bar in Command > line code on line 1 This totally breaks the capsulation in the OO paradigm, so I find it the right behaviour. Taking apart the fact that there's no compilation in PHP, it also prevents capsulation and making a member variable of an object available only after it's declaration in the class (except for stdClass) is correct for me. I see this as "You can't redefine the model at runtime". > > Was this not possible because of the engine implementation of the static > properties? > > Edin -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: [application/pgp-signature]
« previous php.internals (#22956) next »