note 115636 added to errorfunc.constants

From: Date: Fri, 29 Aug 2014 07:06:57 +0000
Subject: note 115636 added to errorfunc.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-200340@lists.php.net to get a copy of this message
How about this? Unlike the examples below, it will show all the bits that are set, AND handle any bits defined in the future (at least not silently hide them)... $strErrorType = ""; $bit = 1; $tmpErrNo = $errNo; while ($tmpErrNo) { if ($tmpErrNo & $bit) { if ($strErrorType != "") $strErrorType .= " | "; switch ($bit) { case E_USER_WARNING: $strErrorType .= "E_USER_WARNING"; break; case E_USER_NOTICE: $strErrorType .= "E_USER_NOTICE"; break; case E_WARNING: $strErrorType .= "E_WARNING"; break; case E_CORE_WARNING: $strErrorType .= "E_CORE_WARNING"; break; case E_COMPILE_WARNING: $strErrorType .= "E_COMPILE_WARNING"; break; case E_NOTICE: $strErrorType .= "E_NOTICE"; break; case E_ERROR: $strErrorType .= "E_ERROR"; break; case E_PARSE: $strErrorType .= "E_PARSE"; break; case E_CORE_ERROR: $strErrorType .= "E_CORE_ERROR"; break; case E_COMPILE_ERROR: $strErrorType .= "E_COMPILE_ERROR"; break; case E_USER_ERROR: $strErrorType .= "E_USER_ERROR"; break; default: $strErrorType .= "(unknown error bit $bit)"; break; } } $tmpErrNo &= ~$bit; $bit <<= 1; } ---- Server IP: 72.52.91.14 Probable Submitter: 24.22.232.181 ---- Manual Page -- http://php.net/manual/en/errorfunc.constants.php Edit -- https://master.php.net/note/edit/115636 Del: integrated -- https://master.php.net/note/delete/115636/integrated Del: useless -- https://master.php.net/note/delete/115636/useless Del: bad code -- https://master.php.net/note/delete/115636/bad+code Del: spam -- https://master.php.net/note/delete/115636/spam Del: non-english -- https://master.php.net/note/delete/115636/non-english Del: in docs -- https://master.php.net/note/delete/115636/in+docs Del: other reasons-- https://master.php.net/note/delete/115636 Reject -- https://master.php.net/note/reject/115636 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200340) next »