实际上我想转换我在输入文本中输入的字符串,然后与另一个数组进行比较。请参见下面的场景:
首先,我在输入文本中输入这种类型的字符串:acgta
其次,我想将“acgta”替换为“TGCAT”,即a=T, c=G, g=C
这是代码:
$data = "acgta";
$s = str_split($data);
$d = array("a" => "T","g" => "C","c" => "G","t" => "A");
foreach($d as $key1 => $value1) {
echo str_replace($key1,$value1,$data);}