Magic Methods in PHP ( __clone() ) OOP concept in Hindi/Urdu.

Поділитися
Вставка
  • Опубліковано 18 вер 2024
  • __clone Magic method.
    The __clone() magic method is triggered on newly cloned objects, where cloning is done using the clone keyword. The method does not accept any parameters nor does it return any values,
    An object copy is created by using the clone keyword (which calls the object’s __clone() method if possible). An object’s __clone() method cannot be called directly.
    When an object is cloned, PHP 5 will perform a shallow copy of all of the object’s properties. Any properties that are references to other variables, will remain references.
    Cloning Objects:
    Object cloning is the act of making a copy of an object.When the object is created with the help of new keyword and assigned the object created to a new variable the object reference will be copied but not the value stored in that object. And now if we want to change the value of the object created the copied object variable will also be affected. Similarly, if we change the copied object, the created object data will be affected. So to solve this problem we will use the concept of cloning
    ==================FOLLOW ME ==================
    Subscribe My Channel for New Releases!
    ------------------- QUESTIONS? ------------------------------
    Leave a comment below and I or someone else can help you.
    For quick questions
    Email me thakurpavinder07@gmail.com
    Thanks for all your support!

КОМЕНТАРІ •