xref: /PHP-8.2/Zend/tests/dtor_scope.phpt (revision a8d901a8)
1--TEST--
2Scoping in destructor call
3--FILE--
4<?php
5        class T
6        {
7                private $var = array();
8
9                public function add($a)
10                {
11                        array_push($this->var, $a);
12                }
13
14                public function __destruct()
15                {
16                        print_r($this->var);
17                }
18        }
19
20        class TT extends T
21        {
22        }
23        $t = new TT();
24        $t->add("Hello");
25        $t->add("World");
26?>
27--EXPECT--
28Array
29(
30    [0] => Hello
31    [1] => World
32)
33