Does PHP provide any Lazy copy concept?
My believe is that Lazy copy is not implemented in PHP(infact is it a correct terminology?) while Lazy loading can be implement on object properties by simple flag property of an object.
I came across a answer(Please see) on SO with a large number of upvote, a part of explanation seems to be completely wrong.
He is saying unless $b is not changed $a will keep only reference of $b.
$b=3;
$a=$b;
// $a points to $b, equals to $a=&$b
$b=4;
// now PHP will copy 3 into $a, and places 4 into $b
I can understand Lazy loading. Keep a flag property in object and whenever we try to get the property of an object just initialize all properties from DB. Pseudo code looks like this:
private function GetAccessor($member) {
if($this->isLoaded != true) {
$this->Load(); //initialize or copy all properties from DB - LAZY LOADING
}
....
Note: php.net also doesn't mentioned lazy copy anywhere.