3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bc() { $argv = func_get_args(); $cmd = $argv[0]; $cmd = preg_replace( "/\$(\d+)/", $argv[$1], $cmd ); return( $cmd ); } $a = bc( "sqrt($1*$1+$2*$2)", 3, 5 );
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.24, 7.3.0 - 7.3.11
Parse error: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in /in/AsuaR on line 8
Process exited with code 255.

preferences:
186.81 ms | 1395 KiB | 53 Q