How do you copy a PHP object into a different object type

后端 未结 5 1833
梦毁少年i
梦毁少年i 2020-12-20 15:50
  1. New class is a subclass of the original object

  2. It needs to be php4 compatible

5条回答
  •  醉话见心
    2020-12-20 16:30

    I would imagine you would have to invent some sort of a "copy constructor". Then you would just create a new subclass object whilst passing in the original object.

提交回复
热议问题