Advanced PHP
Q72 / 100

How does PHP handle object references vs value copies?

Correct! Well done.

Incorrect.

The correct answer is B) Objects are assigned by handle (reference to the object store), so assignment copies the handle not the object; use clone for a copy

B

Correct Answer

Objects are assigned by handle (reference to the object store), so assignment copies the handle not the object; use clone for a copy

Explanation

PHP objects are passed by handle. $b = $a means both point to the same object. Modifying $b modifies the same object. Use clone $a for an independent copy.

Progress
72/100