note 102593 added to language.references.return

[email protected] Wed, 23 Feb 2011 05:36:32 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Keep in mind that returning by reference doesn't work with __callStatic:

class Test {
  private static $_inst;
  public static function & __callStatic ($name, $args) {
    if (!isset(static::$_inst)){ 
      echo "create";
      static::$_inst = (object)"test";
   }
   return static::$_inst;
}

var_dump($a = &Test::abc()); // prints 'create'
$a = null;
var_dump(Test::abc()); // doesn't prints and the instance still exists in Test::$_inst
----
Server IP: 69.147.83.197
Probable Submitter: 80.94.101.83
----
Manual Page -- http://www.php.net/manual/en/language.references.return.php
Edit        -- https://master.php.net/note/edit/102593
Del: integrated  -- https://master.php.net/note/delete/102593/integrated
Del: useless     -- https://master.php.net/note/delete/102593/useless
Del: bad code    -- https://master.php.net/note/delete/102593/bad+code
Del: spam        -- https://master.php.net/note/delete/102593/spam
Del: non-english -- https://master.php.net/note/delete/102593/non-english
Del: in docs     -- https://master.php.net/note/delete/102593/in+docs
Del: other reasons-- https://master.php.net/note/delete/102593
Reject      -- https://master.php.net/note/reject/102593
Search      -- https://master.php.net/manage/user-notes.php