strtr_variation4.phpt [plain text]
--TEST--
Test strtr() function : usage variations - empty string & null for 'str' argument
--FILE--
<?php
echo "*** Testing strtr() : empty string & null for 'str' arg ***\n";
$count = 1;
$heredoc_str = <<<EOD
EOD;
$str_arr = array(
"",
'',
NULL,
null,
FALSE,
false,
$heredoc_str
);
$from = "";
$to = "TEST";
$replace_pairs = array("" => "t", '' => "TEST");
for($index = 0; $index < count($str_arr); $index++) {
echo "-- Iteration $count --\n";
$str = $str_arr[$index];
var_dump( strtr($str, $from, $to) );
var_dump( strtr($str, $replace_pairs) );
$count++;
}
echo "*** Done ***";
?>
--EXPECTF--
*** Testing strtr() : empty string & null for 'str' arg ***
-- Iteration 1 --
string(0) ""
string(0) ""
-- Iteration 2 --
string(0) ""
string(0) ""
-- Iteration 3 --
string(0) ""
string(0) ""
-- Iteration 4 --
string(0) ""
string(0) ""
-- Iteration 5 --
string(0) ""
string(0) ""
-- Iteration 6 --
string(0) ""
string(0) ""
-- Iteration 7 --
string(0) ""
string(0) ""
*** Done ***