3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { public $Something; public $SomethingElse; function setSomething($value) { $this->Something = $value; } function setSomethingElse($value) { $this->SomethingElse = $value; } } $property = "Something"; $t = new test; $setter = "set$property"; $t->$setter(4); echo $t->Something; $property = "SomethingElse"; $t->{"set$property"}(8); echo $t->SomethingElse;

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
170.39 ms | 2026 KiB | 10 Q