note 121911 added to errorfunc.constants

From: Date: Fri, 24 Nov 2017 17:24:12 +0000
Subject: note 121911 added to errorfunc.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-209212@lists.php.net to get a copy of this message
An other way to get all PHP errors that are set to be reported. This code will even work, when additional error types are added in future. <?php $pot = 0; foreach (array_reverse(str_split(decbin(error_reporting()))) as $bit) { if ($bit == 1) { echo array_search(pow(2, $pot), get_defined_constants(true)['Core']). "<br>\n"; } $pot++; } ?> ---- Server IP: 208.43.231.9 Probable Submitter: 217.225.199.4 ---- Manual Page -- http://php.net/manual/en/errorfunc.constants.php Edit -- https://master.php.net/note/edit/121911 Del: integrated -- https://master.php.net/note/delete/121911/integrated Del: useless -- https://master.php.net/note/delete/121911/useless Del: bad code -- https://master.php.net/note/delete/121911/bad+code Del: spam -- https://master.php.net/note/delete/121911/spam Del: non-english -- https://master.php.net/note/delete/121911/non-english Del: in docs -- https://master.php.net/note/delete/121911/in+docs Del: other reasons-- https://master.php.net/note/delete/121911 Reject -- https://master.php.net/note/reject/121911 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209212) next »