3v4l.org

run code in 300+ PHP versions simultaneously
<?php class O { public $string = 'string'; public $int = 0; public $float = 1.0; function method($name) { return $this->$name; } } $o = new O; $switch = 'string'; switch ($switch) { case $o->string: case $o->int: case $o->float: echo "accept\n"; break; } switch ($switch) { case $o->method('string'): case $o->method('int'): case $o->method('float'): echo "accept\n"; break; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
230.57 ms | 2926 KiB | 10 Q