3v4l.org

run code in 300+ PHP versions simultaneously
<?php $old = <<<HEREDOC <?php // Connect $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password') OR die(mysql_error()); // Query $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'", mysql_real_escape_string($user), mysql_real_escape_string($password)); ?> HEREDOC; echo preg_replace('/mysql_([a-zA-Z_]+)\(/', 'mysqli_$1($GLOBALS[\'link\'], ');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $link in /in/LkSrL on line 6 Warning: Undefined variable $query in /in/LkSrL on line 10 Warning: Undefined variable $user in /in/LkSrL on line 11 Warning: Undefined variable $password in /in/LkSrL on line 12 Fatal error: Uncaught ArgumentCountError: preg_replace() expects at least 3 arguments, 2 given in /in/LkSrL:16 Stack trace: #0 /in/LkSrL(16): preg_replace('/mysql_([a-zA-Z...', 'mysqli_$1($GLOB...') #1 {main} thrown in /in/LkSrL on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: link in /in/LkSrL on line 6 Notice: Undefined variable: query in /in/LkSrL on line 10 Notice: Undefined variable: user in /in/LkSrL on line 11 Notice: Undefined variable: password in /in/LkSrL on line 12 Warning: preg_replace() expects at least 3 parameters, 2 given in /in/LkSrL on line 16
Output for 7.3.32 - 7.3.33
Warning: preg_replace() expects at least 3 parameters, 2 given in /in/LkSrL on line 16
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Notice: Undefined variable: link in /in/LkSrL on line 10 Notice: Undefined variable: query in /in/LkSrL on line 11 Notice: Undefined variable: user in /in/LkSrL on line 12 Notice: Undefined variable: password in /in/LkSrL on line 13 Warning: preg_replace() expects at least 3 parameters, 2 given in /in/LkSrL on line 16
Output for 5.2.3 - 5.2.17
Notice: Undefined variable: link in /in/LkSrL on line 10 Notice: Undefined variable: query in /in/LkSrL on line 11 Notice: Undefined variable: user in /in/LkSrL on line 12 Notice: Undefined variable: password in /in/LkSrL on line 13 Warning: Wrong parameter count for preg_replace() in /in/LkSrL on line 16
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.2
Notice: Undefined variable: link in /in/LkSrL on line 6 Notice: Undefined variable: query in /in/LkSrL on line 10 Notice: Undefined variable: user in /in/LkSrL on line 12 Notice: Undefined variable: password in /in/LkSrL on line 14 Warning: Wrong parameter count for preg_replace() in /in/LkSrL on line 16
Output for 5.1.2
Notice: Undefined variable: link in /in/LkSrL on line 6 Notice: Undefined variable: query in /in/LkSrL on line 10 Notice: Undefined variable: user in /in/LkSrL on line 12 Notice: Undefined variable: password in /in/LkSrL on line 14 Warning: Wrong parameter count for preg_replace() in /in/LkSrL on line 17
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.9, 5.0.0 - 5.0.3
Notice: Undefined variable: link in /in/LkSrL on line 6 Notice: Undefined variable: query in /in/LkSrL on line 10 Notice: Undefined variable: user in /in/LkSrL on line 12 Notice: Undefined variable: password in /in/LkSrL on line 14 Warning: Wrong parameter count for preg_replace() in /in/LkSrL on line 16
Output for 4.4.2
Notice: Undefined variable: link in /in/LkSrL on line 6 Notice: Undefined variable: query in /in/LkSrL on line 10 Notice: Undefined variable: user in /in/LkSrL on line 12 Notice: Undefined variable: password in /in/LkSrL on line 14 Warning: Wrong parameter count for preg_replace() in /in/LkSrL on line 17

preferences:
244.07 ms | 402 KiB | 460 Q