You are here : phpstringstrtr

strtr() - string

If given three arguments, this function returns a copy of
   str where all occurrences of each (single-byte)
   character in from have been translated to the
   corresponding character in to, i.e., every
   occurrence of $from[$n] has been replaced with
   $to[$n], where $n is a valid
   offset in both arguments.
Parameters :
  • str - The string being translated.
  • from - The string being translated to to.
  • to - The string replacing from.
  • replace_pairs - The replace_pairs parameter may be used instead of to and from, in which case it's an array in the form array('from' => 'to', ...).

  • Syntax

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


    Example

    <?php//In this form, strtr() does byte-by-byte translation//Therefore, we are assuming a single-byte encoding here:$addr = strtr($addr, "äåö", "aao");?>


    Output / Return Value


    Limitations


    Alternatives / See Also


    Reference