PHP str_ireplace ohne den Fall zu verlieren
Ist es möglich, str_ireplace zu starten, ohne das Originalgehäuse zu zerstören?
Zum Beispiel:
$txt = "Hello How Are You";
$a = "are";
$h = "hello";
$txt = str_ireplace($a, "<span style='background-color:#EEEE00'>".$a."</span>", $txt);
$txt = str_ireplace($h, "<span style='background-color:#EEEE00'>".$h."</span>", $txt);
Das alles funktioniert gut, aber das Ergebnis gibt Folgendes aus:
[hello] How [are] You
anstatt:
[Hello] How [Are] You
(Eckige Klammern sind der farbige Hintergrund)
Vielen Dank.