note 102356 deleted from function.preg-last-error by danbrown

From: Date: Thu, 10 Feb 2011 16:00:43 +0000
Subject: note 102356 deleted from function.preg-last-error by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176859@lists.php.net to get a copy of this message
Note Submitter: asnyder at noloh dot com ---- I thought this might be helpful for those that want to simply find out what error is being thrown without doing their own switch. pcre_error_decode from Luminous, see http://luminous.googlecode.com/, GPL, http://www.gnu.org/licenses/ <?php ** * \ingroup LuminousUtils * \internal * \brief Decodes a PCRE error code into a string * \param errcode The error code to decode (integer) * \return A string which is simply the name of the constant which matches the * error code (e.g. 'PREG_BACKTRACK_LIMIT_ERROR') */ function pcre_error_decode($errcode) { switch ($errcode) { case PREG_NO_ERROR: return 'PREG_NO_ERROR'; case PREG_INTERNAL_ERROR: return 'PREG_INTERNAL_ERROR'; case PREG_BACKTRACK_LIMIT_ERROR: return 'PREG_BACKTRACK_LIMIT_ERROR'; case PREG_RECURSION_LIMIT_ERROR: return 'PREG_RECURSION_LIMIT_ERROR'; case PREG_BAD_UTF8_ERROR: return 'PREG_BAD_UTF8_ERROR'; case PREG_BAD_UTF8_OFFSET_ERROR: return 'PREG_BAD_UTF8_OFFSET_ERROR'; default: return 'Unknown error code'; } } ?>

« previous php.notes (#176859) next »