PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 37 lines | 24 code | 7 blank | 6 comment | 1 complexity | a07902ee7f795de24f06e906a839eb17 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 bool format ***\n";
  8. // Initialise all required variables
  9. $format = "format";
  10. $format1 = "%b";
  11. $format2 = "%b %b";
  12. $format3 = "%b %b %b";
  13. $arg1 = varray[TRUE];
  14. $arg2 = varray[TRUE,FALSE];
  15. $arg3 = varray[TRUE,FALSE,TRUE];
  16. /* creating dumping file */
  17. $data_file = dirname(__FILE__) . '/vfprintf_basic4.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. }