Annotation of embedaddon/php/ext/standard/tests/strings/str_ireplace.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: str_ireplace() tests
3: --FILE--
4: <?php
5:
6: var_dump(str_ireplace());
7: var_dump(str_ireplace(""));
8: var_dump(str_ireplace("", ""));
9: var_dump(str_ireplace("", "", ""));
10:
11: var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
12: var_dump(str_ireplace("tt", "a", "ttttTttttttttTT", $count));
13: var_dump($count);
14:
15: var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT"));
16: var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT", $count));
17: var_dump($count);
18:
19: var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
20: var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
21: var_dump($count);
22:
23: var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
24: var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
25: var_dump($count);
26:
27: var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
28: var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
29: var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));
30:
31: var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
32: var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
33: var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));
34:
35: var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("ttttTttttttttTT", "aayyaayasdayYahsdYYY")));
36: var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
37: var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
38:
39: /* separate testcase for str_ireplace() off-by-one */
40:
41: $Data = "Change tracking and management software designed to watch
42: for abnormal system behavior.\nSuggest features, report bugs, or ask
43: questions here.";
44: var_dump($Data = str_ireplace("\r\n", "<br>", $Data));
45: var_dump($Data = str_ireplace("\n", "<br>", $Data));
46:
47:
48: echo "Done\n";
49: ?>
50: --EXPECTF--
51: Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d
52: NULL
53:
54: Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d
55: NULL
56:
57: Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d
58: NULL
59: string(0) ""
60: string(8) "aaaaaaaT"
61: string(8) "aaaaaaaT"
62: int(7)
63: string(15) "aaaaaaaaaaaaaaT"
64: string(15) "aaaaaaaaaaaaaaT"
65: int(7)
66: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
67: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
68: int(7)
69: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
70: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
71: int(7)
72: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
73: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
74: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
75: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
76: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
77: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
78: array(2) {
79: [0]=>
80: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
81: [1]=>
82: string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
83: }
84: array(2) {
85: ["key"]=>
86: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
87: ["test"]=>
88: string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
89: }
90: array(2) {
91: ["key"]=>
92: string(22) "aaaaaaaaaaaaaaaaaaaaaT"
93: ["test"]=>
94: string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
95: }
96: string(143) "Change tracking and management software designed to watch
97: for abnormal system behavior.
98: Suggest features, report bugs, or ask
99: questions here."
100: string(152) "Change tracking and management software designed to watch<br> for abnormal system behavior.<br>Suggest features, report bugs, or ask<br> questions here."
101: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>