Annotation of embedaddon/php/ext/standard/tests/strings/fprintf_variation_007.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test fprintf() function (variation - 7)
3: --SKIPIF--
4: <?php
5: $data_file = dirname(__FILE__) . '/dump.txt';
6: if (!($fp = fopen($data_file, 'w'))) {
7: die('skip File dump.txt could not be created');
8: }
9: if (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';
18: if (!($fp = fopen($data_file, 'wt')))
19: return;
20:
21: /* octal type variations */
22: fprintf($fp, "\n*** Testing fprintf() for octals ***\n");
23: foreach( $int_numbers as $octal_num ) {
24: fprintf( $fp, "\n");
25: fprintf( $fp, "%o", $octal_num );
26: }
27:
28: fclose($fp);
29:
30: print_r(file_get_contents($data_file));
31: echo "\nDone";
32:
33: unlink($data_file);
34:
35: ?>
36: --EXPECTF--
37: *** Testing fprintf() for octals ***
38:
39: 0
40: 1
41: 37777777777
42: 2
43: 37777777776
44: 131004725
45: 37646773053
46: 2322
47: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>