1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/property_hooks/interface_get_value_as_ref.phpt
2024-07-14 11:55:03 +02:00

32 lines
388 B
PHP

--TEST--
By-value get may be implemented as by-reference
--FILE--
<?php
interface I {
public $prop { get; }
}
class A implements I {
private $_prop;
public $prop {
&get => $this->_prop;
}
}
function test(I $i) {
$ref = &$i->prop;
$ref = 42;
}
$a = new A();
test($a);
var_dump($a);
?>
--EXPECT--
object(A)#1 (1) {
["_prop":"A":private]=>
int(42)
}