strtr()
function strtr(string $string, array|string $from, ?string $to = null): string
Translates bytes pairwise, or applies longest-match-first replacement pairs.
Parameters:
$string(string)$from(array|string)$to(?string), defaultnull, optional
Returns: string
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/string/strtr.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how strtr is implemented in the compiler, see the internals page.