Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP preg_last_error() Function

PHP preg_last_error() Function

PHP Regular Expressions (PCRE)PHP Regular Expressions (PCRE)

The preg_last_error function returns the error code generated by the last PCRE regex execution.

Syntax



int preg_last_error ( void )

Example

Return the elements in the array that match the specified pattern:

)*[!?]/ ' , ' foobar foobar foobar ' ) ; if ( preg_last_error ( ) == PREG_BACKTRACK_LIMIT_ERROR ) { print ' Backtrack limit was exhausted! ' ; } ?>

The execution result is as follows:



Backtrack limit was exhausted!

Return Value

For detailed parameter descriptions, see:PHP Regular Expressions (PCRE)

PHP Regular Expressions (PCRE)PHP Regular Expressions (PCRE)