元のケーシングを破壊せずに str_ireplace を実行することは可能ですか?
例えば:
$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);
これはすべて正常に機能しますが、結果は次のように出力されます。
[hello] How [are] You
それ以外の:
[Hello] How [Are] You
(角括弧は背景色です)
ありがとう。