My question is if using array on str_replace is faster than doing it multiple times. My question goes for only two replaces.
With array
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables");
$yummy = array("pizza", "beer");
$newphrase = str_replace($healthy, $yummy, $phrase);
each search word once
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$newphrase = str_replace("fruits", "pizza", $phrase);
$newphrase = str_replace("vegetables", "beer", $phrase);