PHP Case-insensitive equivalent of strtr
-
26-01-2021 - |
Domanda
Where I could find a case-insensitive version of strtr
?
strtr
is overloaded, I am talking about the following one
string strtr ( string $str , array $replace_pairs )
Soluzione
Use str_ireplace
:
str_ireplace(array_keys($replace_pairs), array_values($replace_pairs), $str);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow