1--TEST-- 2Test strtr() function : error conditions 3--FILE-- 4<?php 5/* Prototype : string strtr(string str, string from[, string to]) 6 * Description: Translates characters in str using given translation tables 7 * Source code: ext/standard/string.c 8*/ 9 10echo "*** Testing strtr() : error conditions ***\n"; 11$str = "string"; 12$from = "string"; 13$to = "STRING"; 14$extra_arg = "extra_argument"; 15 16echo "\n-- Testing strtr() function with Zero arguments --"; 17var_dump( strtr() ); 18 19echo "\n-- Testing strtr() function with less than expected no. of arguments --"; 20var_dump( strtr($str) ); 21 22echo "\n-- Testing strtr() function with more than expected no. of arguments --"; 23var_dump( strtr($str, $from, $to, $extra_arg) ); 24 25echo "Done"; 26?> 27--EXPECTF-- 28*** Testing strtr() : error conditions *** 29 30-- Testing strtr() function with Zero arguments -- 31Warning: strtr() expects at least 2 parameters, 0 given in %s on line %d 32NULL 33 34-- Testing strtr() function with less than expected no. of arguments -- 35Warning: strtr() expects at least 2 parameters, 1 given in %s on line %d 36NULL 37 38-- Testing strtr() function with more than expected no. of arguments -- 39Warning: strtr() expects at most 3 parameters, 4 given in %s on line %d 40NULL 41Done 42