/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/lang/030.phpt
38 строк
691 B
Nikita Popov
Deprecate implicit dynamic properties
26 ноя 2021, 16:10
26 ноя 2021, 16:10
902d643
Код
Авторство
О чём код?
--TEST-- $this in constructor test --FILE-- <?php class foo { public $Name; function __construct($name) { $GLOBALS['List']= &$this; $this->Name = $name; $GLOBALS['List']->echoName(); } function echoName() { $GLOBALS['names'][]=$this->Name; } } function &foo2(&$foo) { return $foo; } $bar1 =new foo('constructor'); $bar1->Name = 'outside'; $bar1->echoName(); $List->echoName(); $foo = new foo('constructor'); $bar1 =& foo2($foo); $bar1->Name = 'outside'; $bar1->echoName(); $List->echoName(); print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; ?> --EXPECT-- success