PageRenderTime 50ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/test/slow/array_object/subclass-isset.php

http://github.com/facebook/hiphop-php
PHP | 19 lines | 16 code | 3 blank | 0 comment | 1 complexity | eba81eb14a043e57d9626dcef6950458 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. class MyArrayObject extends ArrayObject
  3. {
  4. public function offsetGet($index)
  5. {
  6. echo "offsetGet Called!\n";
  7. if (isset($this[$index])) {
  8. return parent::offsetGet($index);
  9. }
  10. return null;
  11. }
  12. }
  13. $obj = new MyArrayObject(['foo' => true]);
  14. var_dump($obj['foo']);
  15. var_dump(isset($obj['foo']));
  16. var_dump(isset($obj['bar']));