- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- Cart Bag Bag Cart Miscellaneous
<?php
$text = array(
'Bag' => 'Cart',
'Cart' => 'Bag',
);
$strings = 'Bag Cart Cart Bag Miscellaneous';
$strings = implode(" ", array_map(fn($v) => $text[$v] ?? $v, explode(" ", $strings)));
echo $strings;