xref: /PHP-8.0/Zend/tests/dereference_004.phpt (revision f8d79582)
1--TEST--
2Testing array dereference on __invoke() result
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8class foo {
9    public $x = array();
10    public function __construct() {
11        $h = array();
12        $h[] = new stdclass;
13        $this->x = $h;
14    }
15    public function __invoke() {
16        return $this->x;
17    }
18}
19
20
21$fo = new foo;
22var_dump($fo()[0]);
23
24?>
25--EXPECTF--
26object(stdClass)#%d (0) {
27}
28