3v4l.org

run code in 300+ PHP versions simultaneously
<?php $val = array("foo" => "to the so called 'bar'"); $data = htmlspecialchars(json_encode($val)); echo <<<HTML <script type='text/javascript'> var data = '$data'; var json = JSON.parse(data); </script> HTML; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/36sdU
function name:  (null)
number of ops:  13
compiled vars:  !0 = $val, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'htmlspecialchars'
          2        INIT_FCALL                                               'json_encode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        SEND_VAR                                                 $3
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
    6     8        ROPE_INIT                                     3  ~7      '%0A%3Cscript+type%3D%27text%2Fjavascript%27%3E%0A++var+data+%3D+%27'
    8     9        ROPE_ADD                                      1  ~7      ~7, !1
         10        ROPE_END                                      2  ~6      ~7, '%27%3B%0A++var+json+%3D+JSON.parse%28data%29%3B%0A%3C%2Fscript%3E%0A'
         11        ECHO                                                     ~6
   13    12      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.08 ms | 1394 KiB | 17 Q