3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace T ; define('ARGUMENT', uniqid()); function callWithArgs(callable $callback, array $args = []) { return function($param) use($callback, $args) { array_walk($args, function(&$arg) use($param) { $arg === \T\ARGUMENT and $arg = $param; }); return $callback(...$args); }; } $t = T\callWithArgs('str_replace', ['dolor', 'DOLOR', T\ARGUMENT]); $string = 'Lorem ipsum dolor simet'; var_dump( $t($string) );
based on Wvg8A
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function T\T\callWithArgs() in /in/MOhdm:17 Stack trace: #0 {main} thrown in /in/MOhdm on line 17
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Fatal error: Call to undefined function T\T\callWithArgs() in /in/MOhdm on line 17
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Parse error: syntax error, unexpected '.' in /in/MOhdm on line 13
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Parse error: syntax error, unexpected '.', expecting ')' in /in/MOhdm on line 13
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/MOhdm on line 7
Process exited with code 255.