Annotation of embedaddon/php/ext/standard/tests/strings/vfprintf_basic2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test vfprintf() function : basic functionality - integer format
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int vfprintf  ( resource $handle  , string $format , array $args  )
                      6:  * Description: Write a formatted string to a stream
                      7:  * Source code: ext/standard/formatted_print.c
                      8: */
                      9: 
                     10: /*
                     11:  *  Testing vfprintf() : basic functionality - using integer format
                     12: */
                     13: 
                     14: echo "*** Testing vfprintf() : basic functionality - using integer format ***\n";
                     15: 
                     16: // Initialise all required variables
                     17: $format = "format";
                     18: $format1 = "%d";
                     19: $format2 = "%d %d";
                     20: $format3 = "%d %d %d";
                     21: $arg1 = array(111);
                     22: $arg2 = array(111,222);
                     23: $arg3 = array(111,222,333);
                     24: 
                     25: /* creating dumping file */
                     26: $data_file = dirname(__FILE__) . '/dump.txt';
                     27: if (!($fp = fopen($data_file, 'wt')))
                     28:    return;
                     29: 
                     30: vfprintf($fp, $format1, $arg1);
                     31: fprintf($fp, "\n"); 
                     32: 
                     33: vfprintf($fp, $format2, $arg2);
                     34: fprintf($fp, "\n"); 
                     35: 
                     36: vfprintf($fp, $format3, $arg3);
                     37: fprintf($fp, "\n"); 
                     38: 
                     39: fclose($fp);
                     40: print_r(file_get_contents($data_file));
                     41: 
                     42: unlink($data_file);
                     43: 
                     44: ?>
                     45: ===DONE===
                     46: --EXPECT--
                     47: *** Testing vfprintf() : basic functionality - using integer format ***
                     48: 111
                     49: 111 222
                     50: 111 222 333
                     51: ===DONE===
                     52: 
                     53: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>