PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/quick/UnsetM.php

http://github.com/facebook/hiphop-php
PHP | 30 lines | 25 code | 3 blank | 2 comment | 0 complexity | acf6219c85bde3e60ace54de191a8dbb 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. <<__EntryPoint>>
  3. function main() {
  4. $a = darray[];
  5. $a[0] = 10;
  6. $a[1] = 11;
  7. $a["hi"] = "HI";
  8. $a["bye"] = "BYE";
  9. unset($a[1]);
  10. unset($a["hi"]);
  11. var_dump($a);
  12. $GLOBALS['a'] = $a;
  13. // Try out G bases
  14. $idxDefined = "foo";
  15. $idxNotDefined = "-- )) \\";
  16. $GLOBALS['a'][$idxDefined] = 071177;
  17. var_dump($GLOBALS['a']);
  18. unset($GLOBALS['a'][$idxDefined]);
  19. unset($GLOBALS['a'][$idxNotDefined]);
  20. var_dump($GLOBALS['a']);
  21. // Regression test for a translator bug
  22. $k = strtolower('blah'); // make it a dynamic string
  23. $s = darray[$k => 123];
  24. unset($s[$k]);
  25. unset($s[$k]); // should have no effect
  26. var_dump($s);
  27. }