3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Query(){ # read params $args = func_get_args(); # replace parameter after parameter, escape (SQL injection) and non-numeric encapsule with '' for($i=1; $i < Count($args); $i++){ if(get_magic_quotes_gpc() == 0) $arg = @mysql_real_escape_string($args[$i]); else $arg = @mysql_real_escape_string(stripslashes($args[$i])); $arg = strtr($arg, array('#'=>'[hash]')); if($arg != 'NULL') $arg = (is_numeric($arg))? $arg : "'".$arg."'"; $args[0] = substr_replace($args[0], $arg, strPos($args[0], '#'),1); } $args[0] .= ';'; return $args[0]; } $id = 501; $check_sql = Query("update user_info set login_counter=login_counter+1, date_last_login=NOW() where id_twitter = #", $id); ECHO $check_sql;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tolsd
function name:  (null)
number of ops:  8
compiled vars:  !0 = $id, !1 = $check_sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, 501
   24     1        INIT_FCALL                                               'query'
          2        SEND_VAL                                                 'update+user_info+set+login_counter%3Dlogin_counter%2B1%2C+date_last_login%3DNOW%28%29+where+id_twitter+%3D+%23'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   26     6        ECHO                                                     !1
          7      > RETURN                                                   1

Function query:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 4
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 44
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 4
Branch analysis from position: 62
Branch analysis from position: 4
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 4
Branch analysis from position: 62
Branch analysis from position: 4
Branch analysis from position: 44
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 44
Branch analysis from position: 34
Branch analysis from position: 44
filename:       /in/tolsd
function name:  Query
number of ops:  67
compiled vars:  !0 = $args, !1 = $i, !2 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FUNC_GET_ARGS                                    ~3      
          1        ASSIGN                                                   !0, ~3
    9     2        ASSIGN                                                   !1, 1
          3      > JMP                                                      ->59
   10     4    >   INIT_FCALL_BY_NAME                                       'get_magic_quotes_gpc'
          5        DO_FCALL                                      0  $6      
          6        IS_EQUAL                                                 $6, 0
          7      > JMPZ                                                     ~7, ->17
          8    >   BEGIN_SILENCE                                    ~8      
          9        INIT_FCALL_BY_NAME                                       'mysql_real_escape_string'
         10        CHECK_FUNC_ARG                                           
         11        FETCH_DIM_FUNC_ARG                               $9      !0, !1
         12        SEND_FUNC_ARG                                            $9
         13        DO_FCALL                                      0  $10     
         14        END_SILENCE                                              ~8
         15        ASSIGN                                                   !2, $10
         16      > JMP                                                      ->27
   11    17    >   BEGIN_SILENCE                                    ~12     
         18        INIT_FCALL_BY_NAME                                       'mysql_real_escape_string'
         19        INIT_FCALL                                               'stripslashes'
         20        FETCH_DIM_R                                      ~13     !0, !1
         21        SEND_VAL                                                 ~13
         22        DO_ICALL                                         $14     
         23        SEND_VAR_NO_REF_EX                                       $14
         24        DO_FCALL                                      0  $15     
         25        END_SILENCE                                              ~12
         26        ASSIGN                                                   !2, $15
   12    27    >   INIT_FCALL                                               'strtr'
         28        SEND_VAR                                                 !2
         29        SEND_VAL                                                 <array>
         30        DO_ICALL                                         $17     
         31        ASSIGN                                                   !2, $17
   14    32        IS_NOT_EQUAL                                             !2, 'NULL'
         33      > JMPZ                                                     ~19, ->44
         34    >   INIT_FCALL                                               'is_numeric'
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                         $20     
         37      > JMPZ                                                     $20, ->40
         38    >   QM_ASSIGN                                        ~21     !2
         39      > JMP                                                      ->43
         40    >   CONCAT                                           ~22     '%27', !2
         41        CONCAT                                           ~23     ~22, '%27'
         42        QM_ASSIGN                                        ~21     ~23
         43    >   ASSIGN                                                   !2, ~21
   15    44    >   INIT_FCALL                                               'substr_replace'
         45        FETCH_DIM_R                                      ~26     !0, 0
         46        SEND_VAL                                                 ~26
         47        SEND_VAR                                                 !2
         48        INIT_FCALL                                               'strpos'
         49        FETCH_DIM_R                                      ~27     !0, 0
         50        SEND_VAL                                                 ~27
         51        SEND_VAL                                                 '%23'
         52        DO_ICALL                                         $28     
         53        SEND_VAR                                                 $28
         54        SEND_VAL                                                 1
         55        DO_ICALL                                         $29     
         56        ASSIGN_DIM                                               !0, 0
         57        OP_DATA                                                  $29
    9    58        PRE_INC                                                  !1
         59    >   COUNT                                            ~31     !0
         60        IS_SMALLER                                               !1, ~31
         61      > JMPNZ                                                    ~32, ->4
   18    62    >   ASSIGN_DIM_OP                .=               8          !0, 0
         63        OP_DATA                                                  '%3B'
   20    64        FETCH_DIM_R                                      ~34     !0, 0
         65      > RETURN                                                   ~34
   21    66*     > RETURN                                                   null

End of function query

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.18 ms | 952 KiB | 25 Q