2 /* Prototype : string strtr(string $str, string $from[, string $to]);
3 string strtr(string $str, array $replace_pairs);
4 * Description: Translates characters in str using given translation tables
5 * Source code: ext/standard/string.c
8 /* Test strtr() function: with unexpected inputs for 'str'
9 * and expected type for 'from' & 'to' arguments
12 echo "*** Testing strtr() function: with unexpected inputs for 'str' ***\n";
14 //get an unset variable
15 $unset_var = 'string_val';
20 public function __toString() {
21 return "sample object";
25 //getting the resource
26 $file_handle = fopen(__FILE__
, "r");
28 // array with different values
63 /*18*/ @$undefined_var,
69 //defining 'from' argument
72 //defining 'to' argument
75 // loop through with each element of the $strings array to test strtr() function
77 for($index = 0; $index < count($strings); $index++
) {
78 echo "-- Iteration $count --\n";
79 $str = $strings[$index];
80 var_dump( strtr($str, $from, $to) );
84 fclose($file_handle); //closing the file handle