3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Create function with the name defined in variable $functionName function MyFunction($argument) { return 'Argument passed is: '.$argument; } $functionName = 'MyFunction'; var_dump(eval("return 'something';")); var_dump($functionName('Calling MyFunction with string.'));
Output for 7.3.24 - 7.3.33, 7.4.12 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
string(9) "something" string(51) "Argument passed is: Calling MyFunction with string."

preferences:
166.44 ms | 403 KiB | 119 Q