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

/hphp/test/quick/packed-isset.php

http://github.com/facebook/hiphop-php
PHP | 34 lines | 30 code | 4 blank | 0 comment | 6 complexity | fb4e8e0bb5869355ab4755dbd890b75d 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. function foo() {
  3. $arr = darray[];
  4. for ($i = 0; $i < 4; $i++) {
  5. $arr[$i] = $i;
  6. }
  7. for ($i = 0; $i < 5; $i++) {
  8. print(isset($arr[2])."\n");
  9. }
  10. for ($i = 0; $i < 5; $i++) {
  11. print(isset($arr[$i])."\n");
  12. }
  13. }
  14. function foo2() {
  15. $arr = darray[];
  16. for ($i = 0; $i < 4; $i++) {
  17. $arr[$i] = null;
  18. }
  19. for ($i = 0; $i < 5; $i++) {
  20. var_dump(isset($arr[2]));
  21. }
  22. for ($i = 0; $i < 5; $i++) {
  23. var_dump(isset($arr[$i]));
  24. }
  25. }
  26. <<__EntryPoint>>
  27. function main_entry(): void {
  28. foo();
  29. foo2();
  30. }