TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
503 B
34 lines
503 B
--TEST--
|
|
Return value by reference (method)
|
|
--FILE--
|
|
<?php
|
|
class Test
|
|
{
|
|
private $value = 1;
|
|
|
|
public function getValue()
|
|
{
|
|
return $this->value;
|
|
}
|
|
|
|
public function &getRefValue()
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|
|
|
|
function main()
|
|
{
|
|
$test = new Test;
|
|
var_dump($test->getValue());
|
|
var_dump($refValue = &$test->getRefValue());
|
|
$refValue = 2;
|
|
var_dump($test->getValue());
|
|
var_dump($test->getRefValue());
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
int(1)
|
|
int(1)
|
|
int(2)
|
|
int(2)
|
|
|