84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I want to replace the word "Dozenten" with "Dozentin" and the word "Dozent" with "Dozenten" using PHP. The problem is, "Dozent" appears in both words. I can't continue using `str_replace`. How to avoid getting results similar to "Dozentenin"?
你可以使用`strtr`函数来实现,它可以在字符串中进行子字符串的翻译(替换):
<?php $s = "Dozenten Dozent Dozent Dozenten"; echo strtr($s, array("Dozenten" > "Dozentin", "Dozent" => "Dozenten"));
你可以使用`strtr`函数来实现,它可以在字符串中进行子字符串的翻译(替换):
<?php $s = "Dozenten Dozent Dozent Dozenten"; echo strtr($s, array("Dozenten" > "Dozentin", "Dozent" => "Dozenten"));