Mostrar lista de opciones

str_replace()

« str_repeat | str_rot13 »
<?php
$mixed 
str_replace (
    
// mixed $search
    
// mixed $replace
    
// mixed $subject
    
  // [int &$count]
);
?>
Resultado
$mixed = '<body text=\'black\'>'
Ejemplos
#1 str_replace  ("%body%",
 
"black",
 
"<body text='%body%'>")
#2 str_replace  ([=> "a"=> "e"=> "i"=> "o"=> "u"=> "A"=> "E"=> "I"=> "O"=> "U"],
 
"",
 
"Hello World of PHP")
#3 str_replace  ([=> "fruits"=> "vegetables"=> "fiber"],
 [
=> "pizza"=> "beer"=> "ice cream"],
 
"You should eat fruits, vegetables, and fiber every day.")
#4 str_replace  ("ll",
 
"",
 
"good golly miss molly!")
#5 str_replace  ([=> "\r\n"=> "\n"=> "\r"],
 [
=> "B"=> "C"=> "D"=> "E"=> "F"],
 
"Line 1\nLine 2\rLine 3\r\nLine 4\n")
#6 str_replace  ([=> "A"=> "B"=> "C"=> "D"=> "E"],
 [
=> "B"=> "C"=> "D"=> "E"=> "F"],
 
"A")
#7 str_replace  ([=> "a"=> "p"],
 [
=> "apple"=> "pear"],
 
"a p")
Ver también
preg_replace, str_ireplace, substr_replace