Annotation of embedaddon/php/ext/standard/tests/strings/fprintf_variation_004.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test fprintf() function (variation - 4)
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: ?>
10: --FILE--
11: <?php
12:
13: $char_variation = array( 'a', "a", 67, -67, 99 );
14:
15: /* creating dumping file */
16: $data_file = dirname(__FILE__) . '/dump.txt';
17: if (!($fp = fopen($data_file, 'wt')))
18: return;
19:
20: /* char type variations */
21: fprintf($fp, "\n*** Testing fprintf() for chars ***\n");
22: foreach( $char_variation as $char ) {
23: fprintf( $fp, "\n");
24: fprintf( $fp,"%c", $char );
25: }
26:
27: fclose($fp);
28:
29: print_r(file_get_contents($data_file));
30: echo "\nDone";
31:
32: unlink($data_file);
33:
34: ?>
35: --EXPECTF--
36: *** Testing fprintf() for chars ***
37:
38: