Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / ereg / tests / split_basic_001.phpt
blob1c11f71ca85da0677a3897864d9af8ca56d3f55c
1 --TEST--
2 Test split() function : basic functionality - test a number of simple split, specifying a limit
3 --FILE--
4 <?php
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
8  * Alias to functions: 
9  */
12  * Test a number of simple split, specifying a limit
13  */
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));
25 echo "Done";
27 --EXPECTF--
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
33 array(2) {
34   [0]=>
35   string(2) "--"
36   [1]=>
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
45 bool(false)
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
52 bool(false)
54 --> Pattern: '[x]|[^x]'; match: 'abcdef'
56 Deprecated: Function split() is deprecated in %s on line %d
57 array(2) {
58   [0]=>
59   string(0) ""
60   [1]=>
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
67 array(2) {
68   [0]=>
69   string(4) "--- "
70   [1]=>
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
77 array(2) {
78   [0]=>
79   string(0) ""
80   [1]=>
81   string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'"
84 --> Pattern: '\a'; match: 'a'
86 Deprecated: Function split() is deprecated in %s on line %d
87 array(2) {
88   [0]=>
89   string(0) ""
90   [1]=>
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
97 array(2) {
98   [0]=>
99   string(0) ""
100   [1]=>
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
107 array(1) {
108   [0]=>
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
115 array(2) {
116   [0]=>
117   string(0) ""
118   [1]=>
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
125 array(2) {
126   [0]=>
127   string(35) "0123456789 |1| 0123456789 |2| 01234"
128   [1]=>
129   string(0) ""
132 --> Pattern: '[[:blank:]]{1,10}'; match: '
133         '
135 Deprecated: Function split() is deprecated in %s on line %d
136 array(2) {
137   [0]=>
138   string(1) "
140   [1]=>
141   string(15) "|1| 
142          |2| 
143         "
146 --> Pattern: '[[:print:]]{3}'; match: ' a '
148 Deprecated: Function split() is deprecated in %s on line %d
149 array(2) {
150   [0]=>
151   string(0) ""
152   [1]=>
153   string(16) " |1|  a  |2|  a "
155 Done