A
A
Anton2017-08-16 10:50:42
PHP
Anton, 2017-08-16 10:50:42

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'}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2017-08-17
Shynkaruk @lonadelsi

$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 your question

Ask a Question

731 491 924 answers to any question