Add properties to stdClass object from another object

前端 未结 4 1812
悲哀的现实
悲哀的现实 2021-02-07 04:26

I would like to be able to do the following:

$obj = new stdClass;
$obj->status = \"success\";

$obj2 = new stdClass;
$obj2->message = \"OK\";
4条回答
  •  心在旅途
    2021-02-07 04:49

    have a look at object cloning http://php.net/manual/en/language.oop5.cloning.php

提交回复
热议问题