3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class S{static function __callStatic($k,$f){static $s;return $k=='get'?$s[$f[0]]:$s[$f[0]]=$f[1];}} $sumService = S::set('sum', function($a, $b) { return $a + $b; }); echo S::get('sum')(1, 2);
Output for 7.0.0 - 7.2.0
3
Output for 5.3.18 - 5.6.28
Parse error: syntax error, unexpected '(', expecting ',' or ';' in /in/9RlKq on line 8
Process exited with code 255.