Return to vfprintf_basic6.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test vfprintf() function : basic functionality - exponential format 3: --FILE-- 4: <?php 5: /* Prototype : int vfprintf ( resource $handle , string $format , array $args ) 6: * Description: Write a formatted string to a stream 7: * Source code: ext/standard/formatted_print.c 8: */ 9: 10: 11: echo "*** Testing vfprintf() : basic functionality - using exponential format ***\n"; 12: 13: // Initialise all required variables 14: $format = "format"; 15: $format1 = "%e"; 16: $format2 = "%e %e"; 17: $format3 = "%e %e %e"; 18: $arg1 = array(1000); 19: $arg2 = array(1000,2000); 20: $arg3 = array(1000,2000,3000); 21: 22: /* creating dumping file */ 23: $data_file = dirname(__FILE__) . '/dump.txt'; 24: if (!($fp = fopen($data_file, 'wt'))) 25: return; 26: 27: vfprintf($fp, $format1,$arg1); 28: fprintf($fp, "\n"); 29: 30: vfprintf($fp, $format2,$arg2); 31: fprintf($fp, "\n"); 32: 33: vfprintf($fp, $format3,$arg3); 34: fprintf($fp, "\n"); 35: 36: fclose($fp); 37: print_r(file_get_contents($data_file)); 38: 39: unlink($data_file); 40: 41: ?> 42: ===DONE=== 43: --EXPECT-- 44: *** Testing vfprintf() : basic functionality - using exponential format *** 45: 1.000000e+3 46: 1.000000e+3 2.000000e+3 47: 1.000000e+3 2.000000e+3 3.000000e+3 48: ===DONE=== 49: