- str_replace: documentation ( source)
<?php
$str = 'value 12; another value; yet one more one; val5';
$src = ["value 12", "another value", "yet one more one", "val5"];
$tgt = ["red","green","blue","violet"];
$res = str_replace($src, $tgt, $str);
echo $res;