$str = "abcdef"; $en = array("a", "b", "c"); $en2 = array("d", "e", "f"); $en_rep = str_replace($en2, $en, $str);