3v4l.org

run code in 300+ PHP versions simultaneously
<?php $val = "LOL='a,`=/0+4Aq|8,l@DsAK,4Y~t}BWHozy;w`O!dFnLi]/1TF9(jb.*4MR9l2iD5rh^'"; var_dump($val); list($name, $value) = explode('=', $val, 2); $regexPattern = sprintf( '/^ %1$s # match a quote at the start of the value ( # capturing sub-pattern used (?: # we do not need to capture this [^%1$s\\\\] # any character other than a quote or backslash |\\\\\\\\ # or two backslashes together |\\\\%1$s # or an escaped quote e.g \" )* # as many characters that match the previous rules ) # end of the capturing sub-pattern %1$s # and the closing quote .*$ # and discard any string after the closing quote /mx', $quote ); $value = preg_replace($regexPattern, '$1', $value); $value = str_replace("\\$quote", $quote, $value); $value = str_replace('\\\\', '\\', $value); var_dump($value);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sHv0k
function name:  (null)
number of ops:  43
compiled vars:  !0 = $val, !1 = $name, !2 = $value, !3 = $regexPattern, !4 = $quote
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'LOL%3D%27a%2C%60%3D%2F0%2B4Aq%7C8%2Cl%40DsAK%2C4Y%7Et%7DBWHozy%3Bw%60O%21dFnLi%5D%2F1TF9%28jb.%2A4MR9l2iD5rh%5E%27'
    4     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%3D'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $7      
          9        FETCH_LIST_R                                     $8      $7, 0
         10        ASSIGN                                                   !1, $8
         11        FETCH_LIST_R                                     $10     $7, 1
         12        ASSIGN                                                   !2, $10
         13        FREE                                                     $7
    8    14        INIT_FCALL                                               'sprintf'
    9    15        SEND_VAL                                                 '%2F%5E%0A++++++++++++++++%251%24s++++++++++%23+match+a+quote+at+the+start+of+the+value%0A++++++++++++++++%28+++++++++++++%23+capturing+sub-pattern+used%0A+++++++++++++++++%28%3F%3A++++++++++%23+we+do+not+need+to+capture+this%0A++++++++++++++++++%5B%5E%251%24s%5C%5C%5D+%23+any+character+other+than+a+quote+or+backslash%0A++++++++++++++++++%7C%5C%5C%5C%5C+++%23+or+two+backslashes+together%0A++++++++++++++++++%7C%5C%5C%251%24s+++%23+or+an+escaped+quote+e.g+%5C%22%0A+++++++++++++++++%29%2A+++++++++++%23+as+many+characters+that+match+the+previous+rules%0A++++++++++++++++%29+++++++++++++%23+end+of+the+capturing+sub-pattern%0A++++++++++++++++%251%24s++++++++++%23+and+the+closing+quote%0A++++++++++++++++.%2A%24+++++++++++%23+and+discard+any+string+after+the+closing+quote%0A++++++++++++++++%2Fmx'
   21    16        SEND_VAR                                                 !4
         17        DO_ICALL                                         $12     
    8    18        ASSIGN                                                   !3, $12
   23    19        INIT_FCALL                                               'preg_replace'
         20        SEND_VAR                                                 !3
         21        SEND_VAL                                                 '%241'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !2, $14
   24    25        INIT_FCALL                                               'str_replace'
         26        NOP                                                      
         27        FAST_CONCAT                                      ~16     '%5C', !4
         28        SEND_VAL                                                 ~16
         29        SEND_VAR                                                 !4
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                         $17     
         32        ASSIGN                                                   !2, $17
   25    33        INIT_FCALL                                               'str_replace'
         34        SEND_VAL                                                 '%5C%5C'
         35        SEND_VAL                                                 '%5C'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $19     
         38        ASSIGN                                                   !2, $19
   27    39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !2
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.67 ms | 1400 KiB | 23 Q