(PHP 5 >= 5.1.0)
Exception::getCode — کد استثنا را باز میگرداند
بازگرداندن کد استثنا.
This function has no parameters.
کد استثنا را بصورت integer باز میگرداند.
Example #1 نمونه Exception::getCode()
<?php
try {
throw new Exception("Some error message", 30);
} catch(Exception $e) {
echo "The exception code is: " . $e->getCode();
}
?>
The above example will output something similar to:
The exception code is: 30