<?php $trans = array("hello" => "hi", "hi" => "hello"); echo strtr("hi all, I said hello", $trans); ?> 以上例程会输出: hello all, I said hi