1--TEST--
2Test fprintf() function (variation - 3)
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 != 4) die("skip this test is for 32bit platform only");
10?>
11--FILE--
12<?php
13
14$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
15
16/* creating dumping file */
17$data_file = dirname(__FILE__) . '/dump.txt';
18if (!($fp = fopen($data_file, 'wt')))
19   return;
20
21/* binary type variations */
22fprintf($fp, "\n*** Testing fprintf() with binary ***\n");
23foreach( $int_numbers as $bin_num ) {
24  fprintf( $fp, "\n");
25  fprintf( $fp, "%b", $bin_num );
26}
27
28fclose($fp);
29
30print_r(file_get_contents($data_file));
31echo "\nDone";
32
33unlink($data_file);
34
35?>
36--EXPECT--
37*** Testing fprintf() with binary ***
38
390
401
4111111111111111111111111111111111
4210
4311111111111111111111111111111110
441011001000000100111010101
4511111110100110111111011000101011
4610011010010
47Done
48