note 120136 deleted from exception.construct by cmb

From: Date: Wed, 09 Nov 2016 12:15:43 +0000
Subject: note 120136 deleted from exception.construct by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207057@lists.php.net to get a copy of this message
Note Submitter: ryan dot jentzsch at gmail dot com ---- Note that the code parameter is not the same as exit($code). Also, the code argument in PHP 7 (possibly earlier versions) is cast to an int including negative values. The code below is completely valid: <?php try { throw new \Exception('Testing', -12.12); } catch (\Exception $exception) { $code = $exception->getCode(); if ($code < 0) { exit(abs($code)); } }

« previous php.notes (#207057) next »