Voting

: five plus four?
(Example: nine)

The Note You're Voting On

andre at koethur dot de
11 years ago
Here is a more advanced function to convert an error code to text:

<?php

function preg_errtxt($errcode)
{
static
$errtext;

if (!isset(
$errtxt))
{
$errtext = array();
$constants = get_defined_constants(true);
foreach (
$constants['pcre'] as $c => $n) if (preg_match('/_ERROR$/', $c)) $errtext[$n] = $c;
}

return
array_key_exists($errcode, $errtext)? $errtext[$errcode] : NULL;
}

?>

<< Back to user notes page

To Top