Skip to content

Instantly share code, notes, and snippets.

@th-yoo
th-yoo / test_undefined_offset_exception.php
Last active September 1, 2019 11:48 — forked from mmacia/test_undefined_offset_exception.php
How to catch an invalid array index offset as a native exception in PHP (RAII supported)
<?php
/**
* this class shows how to override default PHP handler to catch undefined index errors
* and throw it as native exceptions, much more convenient way to work with object
* oriented programs.
*
* @author Moisés Maciá <[email protected]>
* @see http://codeup.net
*/