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

/hphp/test/zend/good/Zend/tests/bug55135.php

http://github.com/facebook/hiphop-php
PHP | 23 lines | 18 code | 3 blank | 2 comment | 0 complexity | 6d21b81973b4bd5f26d867384a36f7bb 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>> function main(): void {
  3. // This fails.
  4. $array = darray[1 => 2];
  5. $a = "1";
  6. unset($array[$a]);
  7. print_r($array);
  8. // Those works.
  9. $array = darray[1 => 2];
  10. $a = 1;
  11. unset($array[$a]);
  12. print_r($array);
  13. $array = darray[1 => 2];
  14. unset($array[1]);
  15. print_r($array);
  16. $array = darray[1 => 2];
  17. $a = 1;
  18. unset($array["1"]);
  19. print_r($array);
  20. }