3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = '<img src="{{ a }}" />'; $payload = '" onload="alert(\'XSS!\');"'; var_dump( str_replace( '{{ a }}', htmlentities($payload, ENT_QUOTES | ENT_HTML5, 'UTF-8'), $string ) ); var_dump( str_replace( '{{ a }}', "/somefile.php?".http_build_query(array('url' => $payload)), $string ) ); var_dump( str_replace( '{{ a }}', urlencode($payload), $string ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/itUZX
function name:  (null)
number of ops:  31
compiled vars:  !0 = $string, !1 = $payload
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Cimg+src%3D%22%7B%7B+a+%7D%7D%22+%2F%3E'
    3     1        ASSIGN                                                       !1, '%22+onload%3D%22alert%28%27XSS%21%27%29%3B%22'
    5     2        INIT_FCALL                                                   'var_dump'
    8     3        INIT_FCALL                                                   'htmlentities'
          4        SEND_VAR                                                     !1
          5        SEND_VAL                                                     51
          6        SEND_VAL                                                     'UTF-8'
          7        DO_ICALL                                             $4      
    6     8        FRAMELESS_ICALL_3                str_replace         ~5      '%7B%7B+a+%7D%7D', $4
    9     9        OP_DATA                                                      !0
         10        SEND_VAL                                                     ~5
    5    11        DO_ICALL                                                     
   14    12        INIT_FCALL                                                   'var_dump'
   17    13        INIT_FCALL                                                   'http_build_query'
         14        INIT_ARRAY                                           ~7      !1, 'url'
         15        SEND_VAL                                                     ~7
         16        DO_ICALL                                             $8      
         17        CONCAT                                               ~9      '%2Fsomefile.php%3F', $8
   15    18        FRAMELESS_ICALL_3                str_replace         ~10     '%7B%7B+a+%7D%7D', ~9
   18    19        OP_DATA                                                      !0
         20        SEND_VAL                                                     ~10
   14    21        DO_ICALL                                                     
   22    22        INIT_FCALL                                                   'var_dump'
   25    23        INIT_FCALL                                                   'urlencode'
         24        SEND_VAR                                                     !1
         25        DO_ICALL                                             $12     
   23    26        FRAMELESS_ICALL_3                str_replace         ~13     '%7B%7B+a+%7D%7D', $12
   26    27        OP_DATA                                                      !0
         28        SEND_VAL                                                     ~13
   22    29        DO_ICALL                                                     
   28    30      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.39 ms | 3040 KiB | 17 Q