3v4l.org

run code in 300+ 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:  21
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        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2Fmysql_%28%5Ba-zA-Z_%5D%2B%29%5C%28%2F'
          3        SEND_VAL                                                 'mysqli_%241%28%24GLOBALS%5B%27link%27%5D%2C+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
   17     7        INIT_FCALL                                               'str_replace'
          8        SEND_VAL                                                 'mysqli_connect%28%24GLOBALS%5B%27link%27%5D%2C+'
          9        SEND_VAL                                                 'mysqli_connect%28'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !1, $5
   18    13        INIT_FCALL                                               'str_replace'
         14        SEND_VAL                                                 '%2C+%29'
         15        SEND_VAL                                                 '%29'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $7      
         18        ASSIGN                                                   !1, $7
   20    19        ECHO                                                     !1
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.54 ms | 1387 KiB | 17 Q