Function: preg_match_all () function: preg_match_all ()
--------------------------------------------------------------------------------
Perl Compatible syntax Library
Preg_match_all
String comparison analysis.
Syntax: int preg_match_all (string pattern, string subject, array matches, int [order]);
Return value: integer
Correspondence type: data processing
Description
This function uses the pattern rule to analyze the comparison string subject as a whole. The values returned from the comparison are placed in the array parameter matches and sorted by order. The value of 'order' can be PREG_PATTERN_ORDER or PREG_SET_ORDER. If there is no order value, the system automatically uses PREG_PATTERN_ORDER to place it in the order value. The return value is the number of matching results. if there is no or an error occurs, the return value is false.
Example
Example of PREG_PATTERN_ORDER
Preg_match_all ("| <[^>] +> (.*) ] +> | U ","
A test
", $ Out, PREG_PATTERN_ORDER );
Print $ out [0] [0]. ",". $ out [0] [1]. "\ n ";
Print $ out [1] [0]. ",". $ out [1] [1]. "\ n"
?>
The return value is
Example:,
This is a test
Example:, this is a test
Example of PREG_SET_ORDER
Preg_match_all ("| <[^>] +> (.*) ] +> | U ","
A test
", $ Out, PREG_SET_ORDER );
Print $ out [0] [0]. ",". $ out [0] [1]. "\ n ";
Print $ out [1] [0]. ",". $ out [1] [1]. "\ n"
?>
The return value is
Example:, Example:
This is a test
, This is a test
<