1--TEST-- 2Test fprintf() function (variation - 5) 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} 9?> 10--FILE-- 11<?php 12 13$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); 14 15/* creating dumping file */ 16$data_file = dirname(__FILE__) . '/dump.txt'; 17if (!($fp = fopen($data_file, 'wt'))) 18 return; 19 20/* %e type variations */ 21fprintf($fp, "\n*** Testing fprintf() for scientific type ***\n"); 22foreach( $int_numbers as $num ) { 23 fprintf( $fp, "\n"); 24 fprintf( $fp, "%e", $num ); 25} 26 27fclose($fp); 28 29print_r(file_get_contents($data_file)); 30echo "\nDone"; 31 32unlink($data_file); 33 34?> 35--EXPECTF-- 36*** Testing fprintf() for scientific type *** 37 380.000000e+0 391.000000e+0 40-1.000000e+0 412.700000e+0 42-2.700000e+0 432.333333e+7 44-2.333333e+7 451.234000e+3 46Done 47