3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr =[['name'=>'luo'],['age'=>22]]; echo json_encode($arr); echo json_encode($arr,true); ?> <script> var test = [<?php echo json_encode($arr,true);?>]; var test = <?php echo json_encode($arr,true);?>; alert(test); </script>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qejAd
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'json_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ECHO                                                     $2
    6     5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $3      
          9        ECHO                                                     $3
    9    10        ECHO                                                     '%3Cscript%3E%0A%0Avar+test+%3D+%5B'
   11    11        INIT_FCALL                                               'json_encode'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $4      
         15        ECHO                                                     $4
         16        ECHO                                                     '%5D%3B%0A++++var+test+%3D+'
   12    17        INIT_FCALL                                               'json_encode'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $5      
         21        ECHO                                                     $5
         22        ECHO                                                     '%3B%0A++++alert%28test%29%3B%0A%3C%2Fscript%3E'
   14    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.53 ms | 1395 KiB | 15 Q