1--TEST-- 2Test vfprintf) function : basic functionality - hexadecimal 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 hexadecimal format ***\n"; 11 12// Initialising different format strings 13$format = "format"; 14$format1 = "%x"; 15$format2 = "%x %x"; 16$format3 = "%x %x %x"; 17 18$format11 = "%X"; 19$format22 = "%X %X"; 20$format33 = "%X %X %X"; 21 22$arg1 = array(11); 23$arg2 = array(11,132); 24$arg3 = array(11,132,177); 25 26/* creating dumping file */ 27$data_file = dirname(__FILE__) . '/vfprintf_basic9.txt'; 28if (!($fp = fopen($data_file, 'wt'))) 29 return; 30 31vfprintf($fp, $format1, $arg1); 32fprintf($fp, "\n"); 33vfprintf($fp, $format11, $arg1); 34fprintf($fp, "\n"); 35 36vfprintf($fp, $format2, $arg2); 37fprintf($fp, "\n"); 38vfprintf($fp, $format22, $arg2); 39fprintf($fp, "\n"); 40 41vfprintf($fp, $format3, $arg3); 42fprintf($fp, "\n"); 43vfprintf($fp, $format33, $arg3); 44fprintf($fp, "\n"); 45 46fclose($fp); 47print_r(file_get_contents($data_file)); 48 49unlink($data_file); 50?> 51===DONE=== 52--EXPECT-- 53*** Testing vfprintf) : basic functionality - using hexadecimal format *** 54b 55B 56b 84 57B 84 58b 84 b1 59B 84 B1 60===DONE=== 61