2 Test split() function : basic functionality - test a number of simple split, 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, 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, 2));
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
37 string(32) "-- |1| --- ab --- |2| --- ab ---"
40 --> Pattern: '()'; match: ''
42 Deprecated: Function split() is deprecated in %s on line %d
44 Warning: split(): Invalid Regular Expression in %s on line %d
47 --> Pattern: '()'; match: 'abcdef'
49 Deprecated: Function split() is deprecated in %s on line %d
51 Warning: split(): Invalid Regular Expression in %s on line %d
54 --> Pattern: '[x]|[^x]'; match: 'abcdef'
56 Deprecated: Function split() is deprecated in %s on line %d
61 string(27) "bcdef |1| abcdef |2| abcdef"
64 --> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
66 Deprecated: Function split() is deprecated in %s on line %d
71 string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---"
74 --> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
76 Deprecated: Function split() is deprecated in %s on line %d
81 string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'"
84 --> Pattern: '\a'; match: 'a'
86 Deprecated: Function split() is deprecated in %s on line %d
91 string(12) " |1| a |2| a"
94 --> Pattern: '[0-9][^0-9]'; match: '2a'
96 Deprecated: Function split() is deprecated in %s on line %d
101 string(14) " |1| 2a |2| 2a"
104 --> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
106 Deprecated: Function split() is deprecated in %s on line %d
109 string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
112 --> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
114 Deprecated: Function split() is deprecated in %s on line %d
119 string(35) "56789 |1| 0123456789 |2| 0123456789"
122 --> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
124 Deprecated: Function split() is deprecated in %s on line %d
127 string(35) "0123456789 |1| 0123456789 |2| 01234"
132 --> Pattern: '[[:blank:]]{1,10}'; match: '
135 Deprecated: Function split() is deprecated in %s on line %d
146 --> Pattern: '[[:print:]]{3}'; match: ' a '
148 Deprecated: Function split() is deprecated in %s on line %d
153 string(16) " |1| a |2| a "