note 120998 added to errorfunc.constants
| From: | espertalhao04 at hotmail dot com | Date: | Thu, 20 Apr 2017 16:58:15 +0000 |
| Subject: | note 120998 added to errorfunc.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209032@lists.php.net to get a copy of this message | ||
A simplified way of writting a function to return a (non-optimal) representation of the error code
as a bitwise string:
<?php
function readable_error_type($error_code)
{
$constants = array();
foreach(get_defined_constants() as $key => $value)
{
if(strpos($key, 'E_') === 0 && ($value <= $error_code) && ($value
& $error_code))
{
$constants[] = $key;
}
}
return implode(' | ', $constants);
}
?>
This only works for values above 0.
----
Server IP: 72.52.91.14
Probable Submitter: 178.166.104.215
----
Manual Page -- http://php.net/manual/en/errorfunc.constants.php
Edit -- https://master.php.net/note/edit/120998
Del: integrated -- https://master.php.net/note/delete/120998/integrated
Del: useless -- https://master.php.net/note/delete/120998/useless
Del: bad code -- https://master.php.net/note/delete/120998/bad+code
Del: spam -- https://master.php.net/note/delete/120998/spam
Del: non-english -- https://master.php.net/note/delete/120998/non-english
Del: in docs -- https://master.php.net/note/delete/120998/in+docs
Del: other reasons-- https://master.php.net/note/delete/120998
Reject -- https://master.php.net/note/reject/120998
Search -- https://master.php.net/manage/user-notes.php