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

后端 未结 4 551
无人共我
无人共我 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:57

    This code is working fine for me in a loop

    $remove = array(
        "market_value",
        "sector_id"
    );
    
    foreach($remove as $key){
        unset($obj_name->$key);
    }
    

提交回复
热议问题