note 37689 deleted from function.error-reporting by bjori
| From: | bjori@php.net | Date: | Mon, 24 Apr 2006 15:30:23 +0000 |
| Subject: | note 37689 deleted from function.error-reporting by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109462@lists.php.net to get a copy of this message | ||
Note Submitter: simon at firepages dot com dot au
----
I needed to get a string representation of the integer value returned by ini_get(
'error_reporting' ) ;& this is what I ended up with if its of any use ... It appears
to work ok.
<?
$err=array(1 => 'E_ERROR' , 2 => 'E_WARNING' , 4 => 'E_PARSE'
, 8 => 'E_NOTICE' ,16 => 'E_CORE_ERROR' ,
32 => 'E_CORE_WARNING' ,64 => 'E_COMPILE_ERROR' ,128 =>
'E_COMPILE_WARNING' ,
256 => 'E_USER_ERROR' ,512 => 'E_USER_WARNING' ,1024 =>
'E_USER_NOTICE' ,2047 => 'E_ALL ');
function foo( &$intval ){
$x=2047;
while( $x > 0 ){
if( $x < $intval ){
$intval = $intval - abs( $x ) ;
return abs( $x ) ;
}
$x = ceil( $x / 2 ) ;
}
}
function bar( $intval ,$err ){
while( $intval > 0 ){
if( isset( $err[$intval] ) ){
$array[] = $err[$intval];
break;
}
$rets = foo( $intval ) ;
$array[] = $err[$rets];
}
return $array ;
}
$intval = 2047 - (int)ini_get( 'error_reporting' ) ;
echo 'E_ALL & ~ ( ' .@implode( ' | ' , bar( $intval , $err ) ) . ' )
';
?>