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.
27 lines
378 B
27 lines
378 B
<?php
|
|
|
|
class Test
|
|
{
|
|
public int $a;
|
|
public int $b;
|
|
|
|
public function test()
|
|
{
|
|
return $this->a + $this->b;
|
|
}
|
|
}
|
|
|
|
function main()
|
|
{
|
|
$obj = new Test();
|
|
$obj->a = 1;
|
|
$obj->b = 2;
|
|
|
|
$arr = array();
|
|
$arr['obj'] = $obj;
|
|
var_dump($obj->test());
|
|
|
|
$obj2 = objval($arr['obj'], 'Test');
|
|
var_dump($obj2);
|
|
var_dump($obj2->test());
|
|
} |