3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Guard { private $x = 'test'; } $guard = new Guard(); $thief = function ($name) { return $this->$name; }; $hydrator = function ($name, $value) { $this->$name = $value; }; echo $thief->bindTo($guard, Guard::class)('x') . "\n"; $hydrator->bindTo($guard, Guard::class)('x', 'bla'); echo $thief->bindTo($guard, Guard::class)('x') . "\n";

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
156.69 ms | 1597 KiB | 8 Q