Notes for php _ clone. _ Construct (-balance _ construct (,-name-age-accountsetId (-tom, 33, Account (200-setId (4-account-balance + 500-account-balance; when you create a new
_ Construct (-> balance = _ construct (,, -> name =-> age =-> account = setId (-> id = 0 = Person ('Tom ', 33, account (200-> setId (4 =-> account-> balance + = 500-> account-> balance;
When creating a new copy ($ p2), the reference saved in the new object ($ p2) points to the same $ account object referenced by $ p1.
If you do not want the object attributes to be shared after being copied, you can explicitly copy them in the _ clone method.Target object
-> Id = 0-> account =->
Http://www.bkjia.com/PHPjc/745143.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/745143.htmlTechArticle__construct (-balance = _ construct (,-name =-age =-account = setId (-id = 0 = Person ('Tom ', 33, account (200-setId (4 =-account-balance + = 500-account-balance; when creating a new...