3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __set($name, $value) { echo "__set()\n"; $this->$name = $value; } } function foo($bar) { $bar->{'some_weird_variable'} = 'some value'; $bar->{"\1\0Test\0another"} = 'one'; } $obj = new Test(); foo($obj); var_dump($obj->{'some_weird_variable'});

preferences:
30.09 ms | 402 KiB | 5 Q