xref: /PHP-5.6/ext/ereg/tests/split_basic_003.phpt (revision 1881091e)
1--TEST--
2Test split() function : basic functionality - a few non-matches
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 */
10
11$replacement = 'r';
12
13var_dump(split('A', '-- a --'));
14var_dump(split('[A-Z]', '-- 0 --'));
15var_dump(split('(a){4}', '--- aaa ---'));
16var_dump(split('^a', '--- ba ---'));
17var_dump(split('b$', '--- ba ---'));
18var_dump(split('[:alpha:]', '--- x ---'));
19
20
21echo "Done";
22?>
23--EXPECTF--
24Deprecated: Function split() is deprecated in %s on line %d
25array(1) {
26  [0]=>
27  string(7) "-- a --"
28}
29
30Deprecated: Function split() is deprecated in %s on line %d
31array(1) {
32  [0]=>
33  string(7) "-- 0 --"
34}
35
36Deprecated: Function split() is deprecated in %s on line %d
37array(1) {
38  [0]=>
39  string(11) "--- aaa ---"
40}
41
42Deprecated: Function split() is deprecated in %s on line %d
43array(1) {
44  [0]=>
45  string(10) "--- ba ---"
46}
47
48Deprecated: Function split() is deprecated in %s on line %d
49array(1) {
50  [0]=>
51  string(10) "--- ba ---"
52}
53
54Deprecated: Function split() is deprecated in %s on line %d
55array(1) {
56  [0]=>
57  string(9) "--- x ---"
58}
59Done
60