3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Proxy { private readonly string $property; } $proxy = new Proxy; $closure = function () { $this->property = 'foo'; }; $closure2 = $closure->bindTo($proxy, 'Proxy'); $closure2(); var_dump($proxy);
Output for 8.1.2 - 8.1.33, 8.2.23 - 8.2.29, 8.3.5 - 8.3.26, 8.4.1 - 8.4.14
object(Proxy)#1 (1) { ["property":"Proxy":private]=> string(3) "foo" }

preferences:
72.62 ms | 406 KiB | 5 Q