3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testThis { protected $_my_var = 'test'; public function getMyVar() { return $this->_my_var; } public function test() { $that = $this; $thisTest = function($otherVar) use ($that) { echo $that->getMyVar() . "\n"; echo $otherVar . "\n"; } return $thisTest("Blabla"); } } $myClass = new testThis(); $myclass->test();
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.29, 5.6.8 - 5.6.13
Parse error: syntax error, unexpected 'return' (T_RETURN) in /in/NA77c on line 19
Process exited with code 255.

preferences:
199.07 ms | 1395 KiB | 64 Q