note 117235 added to function.set-error-handler

From: Date: Thu, 07 May 2015 13:26:35 +0000
Subject: note 117235 added to function.set-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-202465@lists.php.net to get a copy of this message
I saw many checking for all the error constants manually in a switch statement. If you just want to add the type of the error (E_WARNING, E_NOTICE, etc) to your ErrorException, use array_search() with get_defined_constants(): new ErrorException("[" . array_search($errno, get_defined_constants(), true) . "] " . $errstr, 0, $errno, $errfile, $errline); ---- Server IP: 72.52.91.14 Probable Submitter: 91.58.244.136 ---- Manual Page -- http://php.net/manual/en/function.set-error-handler.php Edit -- https://master.php.net/note/edit/117235 Del: integrated -- https://master.php.net/note/delete/117235/integrated Del: useless -- https://master.php.net/note/delete/117235/useless Del: bad code -- https://master.php.net/note/delete/117235/bad+code Del: spam -- https://master.php.net/note/delete/117235/spam Del: non-english -- https://master.php.net/note/delete/117235/non-english Del: in docs -- https://master.php.net/note/delete/117235/in+docs Del: other reasons-- https://master.php.net/note/delete/117235 Reject -- https://master.php.net/note/reject/117235 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202465) next »