3v4l.org

run code in 300+ PHP versions simultaneously
<?php $object = new stdClass; $object->config = new stdClass(); $object->config->currencies = array('USD'); var_Dump(json_encode($object)); exit; var_dump(json_decode('{config:{currencies:["USD"]}}')); echo json_last_error();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/cYpC0
function name:  (null)
number of ops:  27
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    3     3        NEW                                              $5      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               !0, 'config'
          6        OP_DATA                                                  $5
    4     7        FETCH_OBJ_W                                      $7      !0, 'config'
          8        ASSIGN_OBJ                                               $7, 'currencies'
          9        OP_DATA                                                  <array>
    5    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'json_encode'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $9      
         14        SEND_VAR                                                 $9
         15        DO_ICALL                                                 
         16      > EXIT                                                     
    6    17*       INIT_FCALL                                               'var_dump'
         18*       INIT_FCALL                                               'json_decode'
         19*       SEND_VAL                                                 '%7Bconfig%3A%7Bcurrencies%3A%5B%22USD%22%5D%7D%7D'
         20*       DO_ICALL                                         $11     
         21*       SEND_VAR                                                 $11
         22*       DO_ICALL                                                 
    7    23*       INIT_FCALL                                               'json_last_error'
         24*       DO_ICALL                                         $13     
         25*       ECHO                                                     $13
         26*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.99 ms | 1395 KiB | 21 Q