1. Go to this page and download the library: Download imliam/php-catch-exit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
imliam / php-catch-exit example snippets
$db = mysql_connect(...) or die('Could not connect.');
$var = catch_exit(function() {
return "It's all okay.";
}, ...);
echo $var; // "It's all okay."
catch_exit(function() {
exit('Uh-oh!');
}, 'Something went wrong.');
// 'Something went wrong.' is displayed
catch_exit(function() {
exit('Uh-oh, something went wrong!');
}, function($message) {
Log::error("The application exited with the following message: '{$message}'");
return View::make('errors.500')
->with('error', 'An unexpected error occurred.');
});
catch_exit(function() {
new ClassThatDoesNotExist();
}, function($message) {
// ...
});
bash
composer
php
exit('Something went wrong.');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.