Is it possible to delete an object's property in PHP?

后端 未结 4 532
无人共我
无人共我 2020-11-29 03:02

If I have an stdObject say, $a.

Sure there\'s no problem to assign a new property, $a,

$a->new_property = $         


        
4条回答
  •  一向
    一向 (楼主)
    2020-11-29 03:39

    This also works if you are looping over an object.

    unset($object->$key);
    

    No need to use brackets.

提交回复
热议问题