Is there a code that looks for values in one array and changes the values of a string by taking values from another array? Is it possible to integrate the search data and the replacement data into one asoc? an array?
Here is the code:
$a = ['plus', 'minus']; $b = ['+', '-']; echo str_replace($a, $b, 'plus minus plus'); //Можно ли это как то переписать под асоц. массив? //$a = ['plus'=>'+', 'minus'=>'-']; //echo magic($a, 'plus minus plus');