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;
}
?>