Skip to content

Instantly share code, notes, and snippets.

@BenMorel
Last active May 3, 2023 21:36
Show Gist options
  • Save BenMorel/3cb2e2f3bcf0117e168ba68e933affe2 to your computer and use it in GitHub Desktop.
Save BenMorel/3cb2e2f3bcf0117e168ba68e933affe2 to your computer and use it in GitHub Desktop.
The first lines of any decent PHP quick script
<?php
declare(strict_types=1);
error_reporting(E_ALL);
set_error_handler(function ($severity, $message, $file, $line) {
if ((error_reporting() & $severity) === 0) {
return false;
}
throw new ErrorException($message, 0, $severity, $file, $line);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment