← All docs

strtr()

Translates bytes pairwise, or applies longest-match-first replacement pairs.

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), default null, optional

Returns: string

Availability

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how strtr is implemented in the compiler, see the internals page.