3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ["Single 'quotes' and double \"quotes\""]; $escaped = json_encode($data); $escaped = json_encode($data, JSON_HEX_APOS | JSON_HEX_QUOT); echo "var value = JSON.parse('{$escaped}');";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OCW5U
function name:  (null)
number of ops:  15
compiled vars:  !0 = $data, !1 = $escaped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'json_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    6     5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 12
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
    8    10        ROPE_INIT                                     3  ~8      'var+value+%3D+JSON.parse%28%27'
         11        ROPE_ADD                                      1  ~8      ~8, !1
         12        ROPE_END                                      2  ~7      ~8, '%27%29%3B'
         13        ECHO                                                     ~7
         14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.24 ms | 998 KiB | 14 Q