note 102356 added to function.preg-last-error

From: Date: Thu, 10 Feb 2011 08:53:48 +0000
Subject: note 102356 added to function.preg-last-error
Groups: php.notes 
Request: Send a blank email to php-notes+get-176839@lists.php.net to get a copy of this message
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'; } } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 76.15.245.131 ---- Manual Page -- http://www.php.net/manual/en/function.preg-last-error.php Edit -- https://master.php.net/note/edit/102356 Del: integrated -- https://master.php.net/note/delete/102356/integrated Del: useless -- https://master.php.net/note/delete/102356/useless Del: bad code -- https://master.php.net/note/delete/102356/bad+code Del: spam -- https://master.php.net/note/delete/102356/spam Del: non-english -- https://master.php.net/note/delete/102356/non-english Del: in docs -- https://master.php.net/note/delete/102356/in+docs Del: other reasons-- https://master.php.net/note/delete/102356 Reject -- https://master.php.net/note/reject/102356 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176839) next »