Return to vprintf_basic3.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test vprintf() function : basic functionality - float format 3: --FILE-- 4: <?php 5: /* Prototype : string vprintf(string $format , array $args) 6: * Description: Output a formatted string 7: * Source code: ext/standard/formatted_print.c 8: */ 9: 10: echo "*** Testing vprintf() : basic functionality - using float format ***\n"; 11: 12: // Initialise all required variables 13: 14: $format = "format"; 15: $format1 = "%f"; 16: $format2 = "%f %f"; 17: $format3 = "%f %f %f"; 18: 19: $format11 = "%F"; 20: $format22 = "%F %F"; 21: $format33 = "%F %F %F"; 22: $arg1 = array(11.11); 23: $arg2 = array(11.11,22.22); 24: $arg3 = array(11.11,22.22,33.33); 25: 26: $result = vprintf($format1,$arg1); 27: echo "\n"; 28: var_dump($result); 29: 30: $result = vprintf($format11,$arg1); 31: echo "\n"; 32: var_dump($result); 33: 34: $result = vprintf($format2,$arg2); 35: echo "\n"; 36: var_dump($result); 37: 38: $result = vprintf($format22,$arg2); 39: echo "\n"; 40: var_dump($result); 41: 42: $result = vprintf($format3,$arg3); 43: echo "\n"; 44: var_dump($result); 45: 46: $result = vprintf($format33,$arg3); 47: echo "\n"; 48: var_dump($result); 49: 50: ?> 51: ===DONE=== 52: --EXPECT-- 53: *** Testing vprintf() : basic functionality - using float format *** 54: 11.110000 55: int(9) 56: 11.110000 57: int(9) 58: 11.110000 22.220000 59: int(19) 60: 11.110000 22.220000 61: int(19) 62: 11.110000 22.220000 33.330000 63: int(29) 64: 11.110000 22.220000 33.330000 65: int(29) 66: ===DONE===