note 117954 added to language.oop5.decon

From: Date: Mon, 07 Sep 2015 19:58:36 +0000
Subject: note 117954 added to language.oop5.decon
Groups: php.notes 
Request: Send a blank email to php-notes+get-203727@lists.php.net to get a copy of this message
The destruct can perform running even after the die() is being called. The below code will execute the __destruct() function and echos the text successfully. However, the die() runs first, and it continues to run the __destruct(). <?php class test { public $message = ''; public function something() { echo $this->message(); } public function __destruct() { echo 'My scope finished.'; } } $test = new test(); die('Stopping earlier!'); $test->message = 'Hopefully, scope not yet finished'; $test->something(); print_r($test); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 2.49.119.126 ---- Manual Page -- http://php.net/manual/en/language.oop5.decon.php Edit -- https://master.php.net/note/edit/117954 Del: integrated -- https://master.php.net/note/delete/117954/integrated Del: useless -- https://master.php.net/note/delete/117954/useless Del: bad code -- https://master.php.net/note/delete/117954/bad+code Del: spam -- https://master.php.net/note/delete/117954/spam Del: non-english -- https://master.php.net/note/delete/117954/non-english Del: in docs -- https://master.php.net/note/delete/117954/in+docs Del: other reasons-- https://master.php.net/note/delete/117954 Reject -- https://master.php.net/note/reject/117954 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203727) next »