LazyArrayObject
同时可以作为数组和对象访问的类
// $object = new \Imi\Util\LazyArrayObject;
$object = new \Imi\Util\LazyArrayObject([
'id' => 123,
'name' => 'imi',
]);
$object['id'] = 111;
echo 'id:', $object->id, PHP_EOL;
$object->id = 222;
echo 'id:', $object['id'], PHP_EOL;
$arrayData = $object->toArray();
var_dump($arrayData);
当前内容版权归 imiphp.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 imiphp.com .