note 118486 added to class.divisionbyzeroerror
| From: | Manjunath | Date: | Mon, 14 Dec 2015 10:15:47 +0000 |
| Subject: | note 118486 added to class.divisionbyzeroerror | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204346@lists.php.net to get a copy of this message | ||
<?php
class MathOperation extends Error
{
protected $n = 10;
// Try to get the Division by Zero error object and display as Exception
public function doArithmeticOperation(): string
{
try {
$value = $this->n % 0;
} catch (DivisionByZeroError $e) {
return $e->getMessage();
}
}
}
$mathOperationObj = new MathOperation();
echo $mathOperationObj->doArithmeticOperation();
----
Server IP: 72.52.91.14
Probable Submitter: 180.151.201.226
----
Manual Page -- http://php.net/manual/en/class.divisionbyzeroerror.php
Edit -- https://master.php.net/note/edit/118486
Del: integrated -- https://master.php.net/note/delete/118486/integrated
Del: useless -- https://master.php.net/note/delete/118486/useless
Del: bad code -- https://master.php.net/note/delete/118486/bad+code
Del: spam -- https://master.php.net/note/delete/118486/spam
Del: non-english -- https://master.php.net/note/delete/118486/non-english
Del: in docs -- https://master.php.net/note/delete/118486/in+docs
Del: other reasons-- https://master.php.net/note/delete/118486
Reject -- https://master.php.net/note/reject/118486
Search -- https://master.php.net/manage/user-notes.php