Notes for php _ clone _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.