Home > PHP > Function > Strings > strtr()

strtr()

strtr - Translate certain characters

Syntax

string strtr (string $str, string $from, string $to, string $str, array $replace_pairs, string $str, string $from, string $to, string $str, array $replace_pairs)

Arguments

  • str - The string being translated.
  • from - The string being translated to to.
  • to - The string replacing from.
  • str - The replace_pairs parameter may be used as a substitute for to and from in which case it\'s an array in the form array(\'from\' => \'to\',...).
  • replace_pairs
  • str - The string being translated.
  • from - The string being translated to to.
  • to - The string replacing from.
  • str - The replace_pairs parameter may be used as a substitute for to and from in which case it\'s an array in the form array(\'from\' => \'to\',...).
  • replace_pairs

Description

This function returns a copy of str, translating all occurrences of each character in from to the corresponding character in to.

Version

PHP 4, 5

Return value

This function returns a copy of str, translating all occurrences of each character in from to the corresponding character in to.