note 117954 deleted from language.oop5.decon by cmb

From: Date: Mon, 07 Sep 2015 21:19:23 +0000
Subject: note 117954 deleted from language.oop5.decon by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203728@lists.php.net to get a copy of this message
Note Submitter: bimal at sanjaal dot com ---- 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); ?>

« previous php.notes (#203728) next »