2 Test split() function : basic functionality - test a number of simple split, without specifying a limit
5 /* Prototype : proto array split(string pattern, string string [, int limit])
6 * Description: Split string into array by regular expression
7 * Source code: ext/standard/reg.c
12 * Test a number of simple split, without specifying a limit
15 echo "*** Testing ereg() : basic functionality ***\n";
17 include(dirname(__FILE__) . '/regular_expressions.inc');
19 foreach ($expressions as $re) {
20 list($pattern,$string) = $re;
21 echo "\n--> Pattern: '$pattern'; match: '$string'\n";
22 var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string));
28 *** Testing ereg() : basic functionality ***
30 --> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
32 Deprecated: Function split() is deprecated in %s on line %d
44 --> Pattern: '()'; match: ''
46 Deprecated: Function split() is deprecated in %s on line %d
48 Warning: split(): Invalid Regular Expression in %s on line %d
51 --> Pattern: '()'; match: 'abcdef'
53 Deprecated: Function split() is deprecated in %s on line %d
55 Warning: split(): Invalid Regular Expression in %s on line %d
58 --> Pattern: '[x]|[^x]'; match: 'abcdef'
60 Deprecated: Function split() is deprecated in %s on line %d
122 --> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
124 Deprecated: Function split() is deprecated in %s on line %d
129 string(13) " --- |1| --- "
131 string(13) " --- |2| --- "
136 --> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
138 Deprecated: Function split() is deprecated in %s on line %d
150 --> Pattern: '\a'; match: 'a'
152 Deprecated: Function split() is deprecated in %s on line %d
164 --> Pattern: '[0-9][^0-9]'; match: '2a'
166 Deprecated: Function split() is deprecated in %s on line %d
182 --> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
184 Deprecated: Function split() is deprecated in %s on line %d
187 string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
190 --> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
192 Deprecated: Function split() is deprecated in %s on line %d
199 string(30) " |1| 0123456789 |2| 0123456789"
202 --> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
204 Deprecated: Function split() is deprecated in %s on line %d
207 string(35) "0123456789 |1| 0123456789 |2| 01234"
212 --> Pattern: '[[:blank:]]{1,10}'; match: '
215 Deprecated: Function split() is deprecated in %s on line %d
234 --> Pattern: '[[:print:]]{3}'; match: ' a '
236 Deprecated: Function split() is deprecated in %s on line %d