3v4l.org

run code in 300+ PHP versions simultaneously
<?php function safeEval($arg,$badwords=array()) { //if(stripos($arg,$badwords) !== false) $arg = explode("''",$arg); $bardwords = array($badwords); if(in_array($badwords,$arg)) { str_ireplace($badwords,"''",$arg); $arg = $arg; eval($arg); //return; } else eval($arg); } $string = "echo 'Hello drop Kyle';"; $find = array("update","drop"); safeEval($string,$find);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9Kgb
function name:  (null)
number of ops:  7
compiled vars:  !0 = $string, !1 = $find
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, 'echo+%27Hello+drop+Kyle%27%3B'
   18     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'safeeval'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function safeeval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9Kgb
function name:  safeEval
number of ops:  24
compiled vars:  !0 = $arg, !1 = $badwords, !2 = $bardwords
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%27%27'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
    6     7        INIT_ARRAY                                       ~5      !1
          8        ASSIGN                                                   !2, ~5
    7     9        INIT_FCALL                                               'in_array'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13      > JMPZ                                                     $7, ->22
    9    14    >   INIT_FCALL                                               'str_ireplace'
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 '%27%27'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   10    19        ASSIGN                                                   !0, !0
   11    20        INCLUDE_OR_EVAL                                          !0, EVAL
         21      > JMP                                                      ->23
   15    22    >   INCLUDE_OR_EVAL                                          !0, EVAL
   16    23    > > RETURN                                                   null

End of function safeeval

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.86 ms | 1399 KiB | 20 Q