3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function bar(callable $callable) { $callable($this); } function printStr() { echo "hi"; } } $foo = new foo(); $foo->bar(function ($that) { $that->printStr(); // Using $this when not in object context });

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
148.22 ms | 1590 KiB | 8 Q