xref: /PHP-7.1/ext/pcre/tests/match_flags.phpt (revision a7bc2866)
1--TEST--
2preg_match_all() flags
3--FILE--
4<?php
5
6var_dump(preg_match_all('/(.)x/', 'zxax', $match, PREG_PATTERN_ORDER));
7var_dump($match);
8
9var_dump(preg_match_all('/(.)x/', 'zxyx', $match, PREG_SET_ORDER));
10var_dump($match);
11
12var_dump(preg_match_all('/(.)x/', 'zxyx', $match, PREG_OFFSET_CAPTURE));
13var_dump($match);
14
15var_dump(preg_match_all('/(.)x/', 'zxyx', $match, PREG_SET_ORDER | PREG_OFFSET_CAPTURE));
16var_dump($match);
17
18?>
19--EXPECT--
20int(2)
21array(2) {
22  [0]=>
23  array(2) {
24    [0]=>
25    string(2) "zx"
26    [1]=>
27    string(2) "ax"
28  }
29  [1]=>
30  array(2) {
31    [0]=>
32    string(1) "z"
33    [1]=>
34    string(1) "a"
35  }
36}
37int(2)
38array(2) {
39  [0]=>
40  array(2) {
41    [0]=>
42    string(2) "zx"
43    [1]=>
44    string(1) "z"
45  }
46  [1]=>
47  array(2) {
48    [0]=>
49    string(2) "yx"
50    [1]=>
51    string(1) "y"
52  }
53}
54int(2)
55array(2) {
56  [0]=>
57  array(2) {
58    [0]=>
59    array(2) {
60      [0]=>
61      string(2) "zx"
62      [1]=>
63      int(0)
64    }
65    [1]=>
66    array(2) {
67      [0]=>
68      string(2) "yx"
69      [1]=>
70      int(2)
71    }
72  }
73  [1]=>
74  array(2) {
75    [0]=>
76    array(2) {
77      [0]=>
78      string(1) "z"
79      [1]=>
80      int(0)
81    }
82    [1]=>
83    array(2) {
84      [0]=>
85      string(1) "y"
86      [1]=>
87      int(2)
88    }
89  }
90}
91int(2)
92array(2) {
93  [0]=>
94  array(2) {
95    [0]=>
96    array(2) {
97      [0]=>
98      string(2) "zx"
99      [1]=>
100      int(0)
101    }
102    [1]=>
103    array(2) {
104      [0]=>
105      string(1) "z"
106      [1]=>
107      int(0)
108    }
109  }
110  [1]=>
111  array(2) {
112    [0]=>
113    array(2) {
114      [0]=>
115      string(2) "yx"
116      [1]=>
117      int(2)
118    }
119    [1]=>
120    array(2) {
121      [0]=>
122      string(1) "y"
123      [1]=>
124      int(2)
125    }
126  }
127}
128