Values & References7 / 16
Up next

Objects share a handle

<?php
declare(strict_types=1);
// objects are held by handle: both names point at one instance
$a = new stdClass();
$a->count = 0;
$b = $a;
$b->count = 5;
echo $a->count, "\n";
What you're solving

assignment copies the handle, not the object