1--TEST-- 2Test vfprintf() function : basic functionality - float 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 10echo "*** Testing vfprintf() : 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/* creating dumping file */ 27$data_file = dirname(__FILE__) . '/vfprintf_basic3.txt'; 28if (!($fp = fopen($data_file, 'wt'))) 29 return; 30 31vfprintf($fp, $format1,$arg1); 32fprintf($fp, "\n"); 33 34vfprintf($fp,$format11,$arg1); 35fprintf($fp, "\n"); 36 37vfprintf($fp,$format2,$arg2); 38fprintf($fp, "\n"); 39 40vfprintf($fp,$format22,$arg2); 41fprintf($fp, "\n"); 42 43vfprintf($fp,$format3,$arg3); 44fprintf($fp, "\n"); 45 46vfprintf($fp, $format33,$arg3); 47fprintf($fp, "\n"); 48 49fclose($fp); 50print_r(file_get_contents($data_file)); 51 52unlink($data_file); 53?> 54===DONE=== 55--EXPECT-- 56*** Testing vfprintf() : basic functionality - using float format *** 5711.110000 5811.110000 5911.110000 22.220000 6011.110000 22.220000 6111.110000 22.220000 33.330000 6211.110000 22.220000 33.330000 63===DONE=== 64 65