Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
 
PREVIOUS NEXT
Tagged: #php #replace #string
ADD COMMENT
Topic
Name
4+9 =