3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "this is [my] test [string] and [<script>alert(1)</script>] is very long [with] so many pwords]"; echo preg_replace_callback( "#\[([^\]]+)]#", fn($m) => sprintf( '<a href="/story.php?%s">%s</a>', http_build_query(['word' => $m[1]]), htmlspecialchars($m[1]) ), $str );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vEEda
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'this+is+%5Bmy%5D+test+%5Bstring%5D+and+%5B%3Cscript%3Ealert%281%29%3C%2Fscript%3E%5D+is+very+long+%5Bwith%5D+so+many+pwords%5D'
    4     1        INIT_FCALL                                               'preg_replace_callback'
    5     2        SEND_VAL                                                 '%23%5C%5B%28%5B%5E%5C%5D%5D%2B%29%5D%23'
    6     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   10     4        SEND_VAL                                                 ~2
   11     5        SEND_VAR                                                 !0
    4     6        DO_ICALL                                         $3      
   11     7        ECHO                                                     $3
   12     8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vEEda
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'sprintf'
    7     2        SEND_VAL                                                 '%3Ca+href%3D%22%2Fstory.php%3F%25s%22%3E%25s%3C%2Fa%3E'
    8     3        INIT_FCALL                                               'http_build_query'
          4        FETCH_DIM_R                                      ~1      !0, 1
          5        INIT_ARRAY                                       ~2      ~1, 'word'
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
    9     9        INIT_FCALL                                               'htmlspecialchars'
         10        FETCH_DIM_R                                      ~4      !0, 1
         11        SEND_VAL                                                 ~4
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
    6    14        DO_ICALL                                         $6      
    9    15      > RETURN                                                   $6
   10    16*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.8 ms | 1006 KiB | 17 Q