3v4l.org

run code in 300+ PHP versions simultaneously
<?php $unquoted_json = <<<NOTJSON {foo:{qux:1,quux:0}, bar:{}} NOTJSON; $quoted_json = preg_replace('~\w[^:{},]*~', '"$0"', $unquoted_json); $array = json_decode($quoted_json, true); var_export($array); echo "\n---\n"; echo json_encode($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7DI6S
function name:  (null)
number of ops:  21
compiled vars:  !0 = $unquoted_json, !1 = $quoted_json, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7Bfoo%3A%7Bqux%3A1%2Cquux%3A0%7D%2C+bar%3A%7B%7D%7D'
    6     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%7E%5Cw%5B%5E%3A%7B%7D%2C%5D%2A%7E'
          3        SEND_VAL                                                 '%22%240%22'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !1, $4
    7     7        INIT_FCALL                                               'json_decode'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !2, $6
    8    12        INIT_FCALL                                               'var_export'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
    9    15        ECHO                                                     '%0A---%0A'
   10    16        INIT_FCALL                                               'json_encode'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $9      
         19        ECHO                                                     $9
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.89 ms | 1395 KiB | 21 Q