PageRenderTime 954ms CodeModel.GetById 46ms RepoModel.GetById 7ms app.codeStats 0ms

/hphp/test/zend/good/ext/standard/tests/strings/vfprintf_basic6.php

http://github.com/facebook/hiphop-php
PHP | 39 lines | 24 code | 9 blank | 6 comment | 1 complexity | dc5b44d59ba7c01ce60b0ce0ff432812 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?hh
  2. /* Prototype : int vfprintf ( resource $handle , string $format , array $args )
  3. * Description: Write a formatted string to a stream
  4. * Source code: ext/standard/formatted_print.c
  5. */
  6. <<__EntryPoint>> function main(): void {
  7. echo "*** Testing vfprintf() : basic functionality - using exponential format ***\n";
  8. // Initialise all required variables
  9. $format = "format";
  10. $format1 = "%e";
  11. $format2 = "%e %e";
  12. $format3 = "%e %e %e";
  13. $arg1 = varray[1000];
  14. $arg2 = varray[1000,2000];
  15. $arg3 = varray[1000,2000,3000];
  16. /* creating dumping file */
  17. $data_file = dirname(__FILE__) . '/vfprintf_basic6.txt';
  18. if (!($fp = fopen($data_file, 'wt')))
  19. return;
  20. vfprintf($fp, $format1,$arg1);
  21. fprintf($fp, "\n");
  22. vfprintf($fp, $format2,$arg2);
  23. fprintf($fp, "\n");
  24. vfprintf($fp, $format3,$arg3);
  25. fprintf($fp, "\n");
  26. fclose($fp);
  27. print_r(file_get_contents($data_file));
  28. unlink($data_file);
  29. echo "===DONE===\n";
  30. }