Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Memory usage and refcount [RSS Feed]

#1 Jan. 5, 2011 18:16:28

Johannes S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Memory usage and refcount

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


PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php


  • Root
  • » PHP
  • » [PHP-DEV] Memory usage and refcount [RSS Feed]

Board footer

Moderator control

Enjoy the 27th of May

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support