3v4l.org

run code in 300+ PHP versions simultaneously
<?php function escape_input($input) { return str_replace("'", "''", $input); } $a = "\' OR 1 = 1 --"; echo escape_input($a); echo "\n"; $b = chr(0x27)."admin'--"; //echo escape_input($b); echo addslashes($b); echo "\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sE5Ou
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, '%5C%27+OR+1+%3D+1+--'
    6     1        INIT_FCALL                                               'escape_input'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ECHO                                                     $3
    7     5        ECHO                                                     '%0A'
    8     6        ASSIGN                                                   !1, '%27admin%27--'
   10     7        INIT_FCALL                                               'addslashes'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        ECHO                                                     $5
   11    11        ECHO                                                     '%0A'
   14    12      > RETURN                                                   1

Function escape_input:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sE5Ou
function name:  escape_input
number of ops:  8
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%27'
          3        SEND_VAL                                                 '%27%27'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
    4     7*     > RETURN                                                   null

End of function escape_input

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.85 ms | 1397 KiB | 18 Q