Category | some pseudo-types (mixed) |
Code Examples | ";
}
echo " "; // str_replace() will accept strings and arrays. // Provides: $bodytag = str_replace("%body%", "black", "body text='%body%'>"); echo $bodytag . " "; // Provides: Hll Wrld f PHP $vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U"); $onlyconsonants = str_replace($vowels, "", "Hello World of PHP"); print_r($onlyconsonants); echo " "; // Provides: You should eat pizza, beer, and ice cream every day $phrase = "You should eat fruits, vegetables, and fiber every day."; $healthy = array("fruits", "vegetables", "fiber"); $yummy = array("pizza", "meat", "ice cream"); $newphrase = str_replace($healthy, $yummy, $phrase); print($newphrase); |
Test Code | |
Web Link | |
Remarks | |
Cancel |