--TEST-- Test str_replace() function --INI-- precision=14 --FILE-- getMessage() . "\n"; } var_dump(str_replace("a", 1, array("aaa", "bbb"), $count)); var_dump($count); var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count)); var_dump($count); echo "\n-- Testing Resources --\n"; $resource1 = fopen( __FILE__, "r" ); $resource2 = opendir( "." ); try { var_dump(str_replace("stream", "FOUND", $resource1, $count)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } try { var_dump(str_replace("stream", "FOUND", $resource2, $count)); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } echo "\n-- Testing a longer and heredoc string --\n"; $string = << --EXPECTF-- Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d *** Testing Miscellaneous input data *** string(3) "qqq" int(5) array(3) { [0]=> string(3) "qqq" [1]=> string(0) "" [2]=> string(3) "ccc" } int(6) -- Testing objects -- string(12) "Hello, world" int(1) -- Testing arrays -- string(15) "multimultimulti" int(3) string(3) "qqq" int(3) array(2) { [0]=> string(3) "qqq" [1]=> string(3) "ccc" } int(6) str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string array(2) { [0]=> string(3) "111" [1]=> string(3) "bbb" } int(3) array(2) { [0]=> string(4) "aaa3" [1]=> string(4) "2bbb" } int(1) -- Testing Resources -- str_replace(): Argument #3 ($subject) must be of type array|string, resource given str_replace(): Argument #3 ($subject) must be of type array|string, resource given -- Testing a longer and heredoc string -- string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 @#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&* FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789" int(16) -- Testing a heredoc null string -- string(0) "" int(0) -- Testing simple and complex syntax strings -- string(5) "FOUND" string(5) "FOUND" Warning: Undefined variable $strS in %s on line %d string(0) "" string(5) "FOUND" string(5) "FOUND"