3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace Some\TestNamespace; trait trait1 { public function method1() { echo __CLASS__; } } trait trait2 { public function method2() { $this->method1(); } } class class1 { use trait1; use trait2; } $obj = new class1; $closure = function () use ($obj) { $obj->method2(); } $closure();
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '$closure' (T_VARIABLE) in /in/MWvb6 on line 32
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/MWvb6 on line 4
Process exited with code 255.