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

/hphp/test/spec/tests/expressions/source_file_inclusion/include_once.php

http://github.com/facebook/hiphop-php
PHP | 58 lines | 22 code | 21 blank | 15 comment | 0 complexity | d5c4c7b67b4951b27eb6d0503189ab1d 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. <?php
  2. /*
  3. +-------------------------------------------------------------+
  4. | Copyright (c) 2015 Facebook, Inc. (http://www.facebook.com) |
  5. +-------------------------------------------------------------+
  6. */
  7. error_reporting(-1);
  8. // Try to include a non-existant file
  9. $inc = include_once 'XXPositions.inc';
  10. var_dump($inc);
  11. echo "----------------------------------\n";
  12. // Include an existing file
  13. $inc = include 'Positions.inc';
  14. //$inc = include_once 'Positions.inc';
  15. var_dump($inc);
  16. // Include an existing file. It doesn't matter if the first include was with/without
  17. // _once; subsequent use of include_once returns true
  18. $inc = include_once 'Positions.inc';
  19. var_dump($inc);
  20. var_dump(Positions\LEFT);
  21. var_dump(Positions\TOP);
  22. echo "----------------------------------\n";
  23. ///*
  24. // Include Point.inc to get at the Point class type
  25. $inc = include 'Point.inc';
  26. var_dump($inc);
  27. $p1 = new Point(10,20);
  28. //*/
  29. echo "----------------------------------\n";
  30. // Include Circle.inc to get at the Circle class type, which in turn uses the Point type
  31. $inc = include('Circle.inc');
  32. var_dump($inc);
  33. $p2 = new Point(5, 6);
  34. $c1 = new Circle(9, 7, 2.4);
  35. echo "----------------------------------\n";
  36. // get the set of included files
  37. print_r(get_included_files());