note 65049 added to function.error-reporting
| From: | the_bug_the_bug at hotmail dot com | Date: | Mon, 24 Apr 2006 13:20:46 +0000 |
| Subject: | note 65049 added to function.error-reporting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-109429@lists.php.net to get a copy of this message | ||
In response to simon at firepages dot com dot au below:
I wrote a shorter more efficient function which will return a string containing the names of the
error levels set in the .ini file:
<?php
function error_level_tostring($intval, $separator)
{
$errorlevels = array(
2047 => 'E_ALL',
1024 => 'E_USER_NOTICE',
512 => 'E_USER_WARNING',
256 => 'E_USER_ERROR',
128 => 'E_COMPILE_WARNING',
64 => 'E_COMPILE_ERROR',
32 => 'E_CORE_WARNING',
16 => 'E_CORE_ERROR',
8 => 'E_NOTICE',
4 => 'E_PARSE',
2 => 'E_WARNING',
1 => 'E_ERROR');
$result = '';
foreach($errorlevels as $number => $name)
{
if (($intval & $number) == $number) {
$result .= ($result != '' ? $separator : '').$name; }
}
return $result;
}
?>
P.S. With a little modification this function can be made to show the string values of any
enumeration.
----
Server IP: 83.137.20.120
Probable Submitter: 145.33.126.3
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.error-reporting.php
Edit -- http://master.php.net/note/edit/65049
Del: integrated -- http://master.php.net/note/delete/65049/integrated
Del: useless -- http://master.php.net/note/delete/65049/useless
Del: bad code -- http://master.php.net/note/delete/65049/bad+code
Del: spam -- http://master.php.net/note/delete/65049/spam
Del: non-english -- http://master.php.net/note/delete/65049/non-english
Del: in docs -- http://master.php.net/note/delete/65049/in+docs
Del: other reasons-- http://master.php.net/note/delete/65049
Reject -- http://master.php.net/note/reject/65049
Search -- http://master.php.net/manage/user-notes.php