1--TEST--
2Test fprintf() function (variation - 8)
3--SKIPIF--
4<?php
5$data_file = dirname(__FILE__) . '/dump.txt';
6if (!($fp = fopen($data_file, 'w'))) {
7  die('skip File dump.txt could not be created');
8}
9if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
10?>
11--FILE--
12<?php
13
14$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
15$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
16
17/* creating dumping file */
18$data_file = dirname(__FILE__) . '/dump.txt';
19if (!($fp = fopen($data_file, 'wt')))
20   return;
21
22/* hexadecimal type variations */
23fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
24foreach( $int_numbers as $hexa_num ) {
25 fprintf( $fp, "\n");
26 fprintf( $fp, "%x", $hexa_num );
27}
28
29fclose($fp);
30
31print_r(file_get_contents($data_file));
32echo "\nDone";
33
34unlink($data_file);
35
36?>
37--EXPECT--
38*** Testing fprintf() for hexadecimals ***
39
400
411
42ffffffffffffffff
432
44fffffffffffffffe
4516409d5
46fffffffffe9bf62b
474d2
48Done
49