Last active
March 27, 2019 17:50
-
-
Save vbarbarosh/6a869804adafcaed93ea88da54a011b4 to your computer and use it in GitHub Desktop.
php_templ_cli – A template for simple php cli scripts https://codescreens.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // https://stackoverflow.com/a/2071048/1478566 | |
| set_error_handler(function ($code, $message, $filename, $lineno) { | |
| throw new ErrorException($message, $code, 0, $filename, $lineno); | |
| }); | |
| // The above code is necessary to terminate program in all of the | |
| // following cases: | |
| // PHP Warning: strpos() expects at least 2 parameters, 0 given | |
| strpos(); | |
| // PHP Warning: file_get_contents(/no/file): failed to open stream: No | |
| // such file or directory | |
| file_get_contents('/no/file'); | |
| // PHP Notice: Undefined variable: foobar | |
| echo $foobar, PHP_EOL; | |
| // PHP Notice: Notice: Undefined offset: 5 | |
| echo [1,2,3][5], PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment