dereference_004.phpt 397 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Testing array dereference on __invoke() result
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. class foo {
  7. public $x = array();
  8. public function __construct() {
  9. $h = array();
  10. $h[] = new stdclass;
  11. $this->x = $h;
  12. }
  13. public function __invoke() {
  14. return $this->x;
  15. }
  16. }
  17. $fo = new foo;
  18. var_dump($fo()[0]);
  19. ?>
  20. --EXPECTF--
  21. object(stdClass)#%d (0) {
  22. }