note 53772 added to language.oop5.basic

From: Date: Sun, 12 Jun 2005 21:30:11 +0000
Subject: note 53772 added to language.oop5.basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-90322@lists.php.net to get a copy of this message
Note the little correction on graced's notes below: Your explanation looks correct about how instances created and destroyed, just wanted to correct some errors in your code below. But Thank you greatly for explaining that I appreciate it. <?php $obj1 = new stdclass(); var_dump($obj1); // object #1 $obj1 = new stdclass(); var_dump($obj1); // object #2 // no more references to object #1, so it is destroyed. $obj1 = new stdclass(); // object #1 (object #2 destroyed right after this expression) var_dump($obj1); $obj2 = $obj1; // two variables now reference object #1 $obj1 = new stdclass(); // becomes object #2 var_dump($obj1); $obj1 = new stdclass(); // object #3 var_dump($obj1); ?> Output: object(stdClass)#1 (0) { } object(stdClass)#2 (0) { } object(stdClass)#1 (0) { } object(stdClass)#2 (0) { } object(stdClass)#3 (0) { } ---- Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53772 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53772&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53772&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53772&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53772&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53772&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53772&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90322) next »