/2.0/Tests/Strings/strtr.php

# · PHP · 22 lines · 14 code · 7 blank · 1 comment · 0 complexity · 1a7eee13cf19b25a14f9dd0437074e0b MD5 · raw file

  1. [expect php]
  2. [file]
  3. <pre>
  4. <?php
  5. $addr = "this is some address.\n";
  6. echo strtr($addr, "aaimm", "AEIOU");
  7. $trans = array("hello" => "hi", "hi" => "hello");
  8. echo strtr("hi all, I said hello\n", $trans);
  9. // hello all, I said hi
  10. $trans = array_flip(array("a" => "e", "b" => "e"));
  11. echo strtr("hi all, I said hello\n", $trans);
  12. $trans = array("a" => 1, "e" => false, 1 => "ONE", 3.14 => round(M_PI,5));
  13. echo strtr("12[3]45, hi all, I said hello\n", $trans);
  14. ?>
  15. </pre>