note 106015 added to language.oop5.static

From: Date: Mon, 03 Oct 2011 09:02:30 +0000
Subject: note 106015 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-183594@lists.php.net to get a copy of this message
in order to use __destruct() in a class without instance (see the sample code in the comment below), you must assign return value of new B(); to a static private variable class-wide or else __destruct() will be called at the end of init() function because the return value of new B() will be treated as a local variable e.g.: <?php class B { static private $fakeClass = null; static public init($autoSave) { self::$fakeClass = new B(); } /* rest of the code */ } ---- Server IP: 69.147.83.197 Probable Submitter: 194.19.225.226 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.static.php Edit -- https://master.php.net/note/edit/106015 Del: integrated -- https://master.php.net/note/delete/106015/integrated Del: useless -- https://master.php.net/note/delete/106015/useless Del: bad code -- https://master.php.net/note/delete/106015/bad+code Del: spam -- https://master.php.net/note/delete/106015/spam Del: non-english -- https://master.php.net/note/delete/106015/non-english Del: in docs -- https://master.php.net/note/delete/106015/in+docs Del: other reasons-- https://master.php.net/note/delete/106015 Reject -- https://master.php.net/note/reject/106015 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#183594) next »