3v4l.org

run code in 500+ PHP versions simultaneously
<?php $old = <<<'NOWDOC' <?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)); ?> NOWDOC; $new = preg_replace('/mysql_([a-zA-Z_]+)\(/', 'mysqli_$1($GLOBALS[\'link\'], ', $old); $new = str_replace('mysqli_connect($GLOBALS[\'link\'], ', 'mysqli_connect(', $new); $new = str_replace(', )', ')', $new); echo $new;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0WiJ5
function name:  (null)
number of ops:  12
compiled vars:  !0 = $old, !1 = $new
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3C%3Fphp%0A%2F%2F+Connect%0A%24link+%3D+mysql_connect%28%27mysql_host%27%2C+%27mysql_user%27%2C+%27mysql_password%27%29%0A++++OR+die%28mysql_error%28%29%29%3B%0A%0A%2F%2F+Query%0A%24query+%3D+sprintf%28%22SELECT+%2A+FROM+users+WHERE+user%3D%27%25s%27+AND+password%3D%27%25s%27%22%2C%0A++++++++++++mysql_real_escape_string%28%24user%29%2C%0A++++++++++++mysql_real_escape_string%28%24password%29%29%3B%0A%3F%3E'
   16     1        FRAMELESS_ICALL_3                preg_replace        ~3      '%2Fmysql_%28%5Ba-zA-Z_%5D%2B%29%5C%28%2F', 'mysqli_%241%28%24GLOBALS%5B%27link%27%5D%2C+'
          2        OP_DATA                                                      !0
          3        ASSIGN                                                       !1, ~3
   17     4        FRAMELESS_ICALL_3                str_replace         ~5      'mysqli_connect%28%24GLOBALS%5B%27link%27%5D%2C+', 'mysqli_connect%28'
          5        OP_DATA                                                      !1
          6        ASSIGN                                                       !1, ~5
   18     7        FRAMELESS_ICALL_3                str_replace         ~7      '%2C+%29', '%29'
          8        OP_DATA                                                      !1
          9        ASSIGN                                                       !1, ~7
   20    10        ECHO                                                         !1
         11      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
219.79 ms | 3443 KiB | 13 Q