1--TEST-- 2Test fprintf() function (variation - 7) 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/* octal type variations */ 22fprintf($fp, "\n*** Testing fprintf() for octals ***\n"); 23foreach( $int_numbers as $octal_num ) { 24 fprintf( $fp, "\n"); 25 fprintf( $fp, "%o", $octal_num ); 26} 27 28fclose($fp); 29 30print_r(file_get_contents($data_file)); 31echo "\nDone"; 32 33unlink($data_file); 34 35?> 36--EXPECTF-- 37*** Testing fprintf() for octals *** 38 390 401 4137777777777 422 4337777777776 44131004725 4537646773053 462322 47Done 48