Voting

: min(nine, six)?
(Example: nine)

The Note You're Voting On

ErikBachmann
5 years ago
<?php
function getErrorTypeByValue($type) {
$constants = get_defined_constants(true);

foreach (
$constants['Core'] as $key => $value ) { // Each Core constant
if ( preg_match('/^E_/', $key ) ) { // Check error constants
if ( $type == $value )
return(
"$key=$value");
}
}
}
// getErrorTypeByValue()

echo "[".getErrorTypeByValue( 1 ) . "]". PHP_EOL;
echo
"[".getErrorTypeByValue( 0 ) . "]". PHP_EOL;
echo
"[".getErrorTypeByValue( 8 ) . "]". PHP_EOL;
?>

Will give
[E_ERROR=1]
[]
[E_NOTICE=8]

<< Back to user notes page

To Top