Answers for "php replace string up to a condition"

PHP
8

php replace string within string

$new_string = str_replace( $take_out, $put_in, $string);
Posted by: Guest on August-18-2020
1

php replace string

$phrase  = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");

$newphrase = str_replace($healthy, $yummy, $phrase);
// => $newphrase = You should eat pizza, beer, and ice cream every day
Posted by: Guest on December-29-2021

Browse Popular Code Answers by Language