/2.0/Tests/Strings/strtr.php
# · PHP · 22 lines · 14 code · 7 blank · 1 comment · 0 complexity · 1a7eee13cf19b25a14f9dd0437074e0b MD5 · raw file
- [expect php]
- [file]
-
- <pre>
- <?php
- $addr = "this is some address.\n";
- echo strtr($addr, "aaimm", "AEIOU");
-
- $trans = array("hello" => "hi", "hi" => "hello");
- echo strtr("hi all, I said hello\n", $trans);
-
- // hello all, I said hi
-
- $trans = array_flip(array("a" => "e", "b" => "e"));
- echo strtr("hi all, I said hello\n", $trans);
-
- $trans = array("a" => 1, "e" => false, 1 => "ONE", 3.14 => round(M_PI,5));
- echo strtr("12[3]45, hi all, I said hello\n", $trans);
-
- ?>
- </pre>