fbiville
fbiville

Reputation: 8950

PHP Case-insensitive equivalent of strtr

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 )

Upvotes: 2

Views: 3184

Answers (1)

Arnaud Le Blanc
Arnaud Le Blanc

Reputation: 99909

Use str_ireplace:

str_ireplace(array_keys($replace_pairs), array_values($replace_pairs), $str);

Upvotes: 7

Related Questions