Jason Garber wrote:
Would it be possible to create a new object property attribute:
readonly
class xx
{
readonly $bar;
}
$o = new xx();
$o->bar = 10;
>>> FATAL ERROR
This way, PHP would allow reading (as if it were public), but only
allow writing from within the class.
Uhh... how about using private and only using a "regular"
getter (the Java-style) and no setter?
class xx
{
private $bar;
public getBar() { return $bar; }
}
$o = new xx();
$o->bar = 10; // already emits FATAL ERROR
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php