Categories
How to replace multiple values of one variable in smarty?
Tell me how to replace several values in one variable, for example: Text to Text1, Text2 to Text3, and so on.{$var|replace:'Text':'Text1'}
{$var|replace:'Text':'Text1'}
Answer the question
In order to leave comments, you need to log in
$str = "apple banana pineapple"; $replaced = str_replace( ["apple", "banana"], ["orange", "lime"], $str ); print $replaced; // orange lime pineapple
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question