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

http://github.com/facebook/hiphop-php · PHP · 31 lines · 29 code · 2 blank · 0 comment · 8 complexity · bdd76af510d0818a86920ce388809a55 MD5 · raw file

  1. <?hh <<__EntryPoint>> function main(): void {
  2. $arr = darray['exists' => 'foz'];
  3. if (isset($arr['exists']['non_existent'])) {
  4. echo "sub-key 'non_existent' is set: ";
  5. var_dump($arr['exists']['non_existent']);
  6. } else {
  7. echo "sub-key 'non_existent' is not set.\n";
  8. }
  9. if (isset($arr['exists'][1])) {
  10. echo "sub-key 1 is set: ";
  11. var_dump($arr['exists'][1]);
  12. } else {
  13. echo "sub-key 1 is not set.\n";
  14. }
  15. echo "-------------------\n";
  16. if (isset($arr['exists']['non_existent']['sub_sub'])) {
  17. echo "sub-key 'sub_sub' is set: ";
  18. var_dump($arr['exists']['non_existent']['sub_sub']);
  19. } else {
  20. echo "sub-sub-key 'sub_sub' is not set.\n";
  21. }
  22. if (isset($arr['exists'][1][0])) {
  23. echo "sub-sub-key 0 is set: ";
  24. var_dump($arr['exists'][1][0]);
  25. } else {
  26. echo "sub-sub-key 0 is not set.\n";
  27. }
  28. echo "DONE";
  29. }