1--TEST-- 2Test fprintf() function (variation - 8) 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); 6?> 7--FILE-- 8<?php 9 10$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" ); 11$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); 12 13/* creating dumping file */ 14$data_file = __DIR__ . '/fprintf_variation_008.txt'; 15if (!($fp = fopen($data_file, 'wt'))) 16 return; 17 18/* hexadecimal type variations */ 19fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n"); 20foreach( $int_numbers as $hexa_num ) { 21 fprintf( $fp, "\n"); 22 fprintf( $fp, "%x", $hexa_num ); 23} 24 25fclose($fp); 26 27print_r(file_get_contents($data_file)); 28echo "\nDone"; 29 30unlink($data_file); 31 32?> 33--EXPECT-- 34*** Testing fprintf() for hexadecimals *** 35 360 371 38ffffffff 392 40fffffffe 4116409d5 42fe9bf62b 434d2 44Done 45