且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

警告:从空值创建默认对象(典型解决方案不能解决问题)

更新时间:2023-12-04 17:40:16

如果您想避免警告,您需要预先创建每个级别:

If you want to avoid the warning you'll need to pre-create each level:

$data = new stdClass();
$data->result = new stdClass();
$data->result->complex = new stdClass();
$data->result->complex->first_key = $old_data->result->complex;