On Wed, 2011-01-05 at 18:30 +0100, Patrick ALLAERT wrote:
> <?php
> class foo {
> static function def() {
> // $x as a static *function* var
> static $x = "foo";
> return $x;
$x is a reference to the static variable. It has to since assignment to
$x, which is a local variable, should change the static variable. This
is returned using copy semantis so we can't do copy on write.
Whereas with
> class foo {
> // $x as a static *class* var
> static $x = "foo";
> static function def() {
> return self::$x;
> }
> }
you are explicitly referencing the static class property. CoW can work
properly.
johannes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php