Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- str_ireplace() tests --FILE-- <?php var_dump(str_ireplace("", "", "")); var_dum..

Decoded Output download

--TEST--
str_ireplace() tests
--FILE--
<?php

var_dump(str_ireplace("", "", ""));

var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "a", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));

var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));

var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("ttttTttttttttTT", "aayyaayasdayYahsdYYY")));
var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));

/* separate testcase for str_ireplace() off-by-one */

$Data = "Change tracking and management software designed to watch
    for abnormal system behavior.
Suggest features, report bugs, or ask
    questions here.";
var_dump($Data = str_ireplace("
", "<br>", $Data));
var_dump($Data = str_ireplace("
", "<br>", $Data));


echo "Done
";
?>
--EXPECT--
string(0) ""
string(8) "aaaaaaaT"
string(8) "aaaaaaaT"
int(7)
string(15) "aaaaaaaaaaaaaaT"
string(15) "aaaaaaaaaaaaaaT"
int(7)
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
int(7)
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
int(7)
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
array(2) {
  [0]=>
  string(22) "aaaaaaaaaaaaaaaaaaaaaT"
  [1]=>
  string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
array(2) {
  ["key"]=>
  string(22) "aaaaaaaaaaaaaaaaaaaaaT"
  ["test"]=>
  string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
array(2) {
  ["key"]=>
  string(22) "aaaaaaaaaaaaaaaaaaaaaT"
  ["test"]=>
  string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
string(149) "Change tracking and management software designed to watch
    for abnormal system behavior.
Suggest features, report bugs, or ask
    questions here."
string(158) "Change tracking and management software designed to watch<br>    for abnormal system behavior.<br>Suggest features, report bugs, or ask<br>    questions here."
Done

Did this file decode correctly?

Original Code

--TEST--
str_ireplace() tests
--FILE--
<?php

var_dump(str_ireplace("", "", ""));

var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "a", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
var_dump($count);

var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));

var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));

var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("ttttTttttttttTT", "aayyaayasdayYahsdYYY")));
var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));

/* separate testcase for str_ireplace() off-by-one */

$Data = "Change tracking and management software designed to watch
    for abnormal system behavior.\nSuggest features, report bugs, or ask
    questions here.";
var_dump($Data = str_ireplace("\r\n", "<br>", $Data));
var_dump($Data = str_ireplace("\n", "<br>", $Data));


echo "Done\n";
?>
--EXPECT--
string(0) ""
string(8) "aaaaaaaT"
string(8) "aaaaaaaT"
int(7)
string(15) "aaaaaaaaaaaaaaT"
string(15) "aaaaaaaaaaaaaaT"
int(7)
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
int(7)
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
int(7)
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
string(22) "aaaaaaaaaaaaaaaaaaaaaT"
array(2) {
  [0]=>
  string(22) "aaaaaaaaaaaaaaaaaaaaaT"
  [1]=>
  string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
array(2) {
  ["key"]=>
  string(22) "aaaaaaaaaaaaaaaaaaaaaT"
  ["test"]=>
  string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
array(2) {
  ["key"]=>
  string(22) "aaaaaaaaaaaaaaaaaaaaaT"
  ["test"]=>
  string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
string(149) "Change tracking and management software designed to watch
    for abnormal system behavior.
Suggest features, report bugs, or ask
    questions here."
string(158) "Change tracking and management software designed to watch<br>    for abnormal system behavior.<br>Suggest features, report bugs, or ask<br>    questions here."
Done

Function Calls

str_ireplace 1

Variables

None

Stats

MD5 37962ddb0171c84f108f28a1212409f9
Eval Count 0
Decode Time 113 ms