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