3v4l.org

run code in 300+ PHP versions simultaneously
<?php $so = new \stdClass; $so->a = 1; $obj = new \stdClass(); $obj->z = $so; $arr = array(new \stdClass(), array('a' => 1, 'b' => $so, 'c' => $obj, array($obj)), $so); $result = @json_encode($so, 0,3); var_dump($result, json_last_error(), json_last_error_msg());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JBReA
function name:  (null)
number of ops:  39
compiled vars:  !0 = $so, !1 = $obj, !2 = $arr, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        ASSIGN_OBJ                                               !0, 'a'
          4        OP_DATA                                                  1
    6     5        NEW                                              $8      'stdClass'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
    7     8        ASSIGN_OBJ                                               !1, 'z'
          9        OP_DATA                                                  !0
    9    10        NEW                                              $12     'stdClass'
         11        DO_FCALL                                      0          
         12        INIT_ARRAY                                       ~14     $12
         13        INIT_ARRAY                                       ~15     1, 'a'
         14        ADD_ARRAY_ELEMENT                                ~15     !0, 'b'
         15        ADD_ARRAY_ELEMENT                                ~15     !1, 'c'
         16        INIT_ARRAY                                       ~16     !1
         17        ADD_ARRAY_ELEMENT                                ~15     ~16
         18        ADD_ARRAY_ELEMENT                                ~14     ~15
         19        ADD_ARRAY_ELEMENT                                ~14     !0
         20        ASSIGN                                                   !2, ~14
   11    21        BEGIN_SILENCE                                    ~18     
         22        INIT_FCALL                                               'json_encode'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 0
         25        SEND_VAL                                                 3
         26        DO_ICALL                                         $19     
         27        END_SILENCE                                              ~18
         28        ASSIGN                                                   !3, $19
   13    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !3
         31        INIT_FCALL                                               'json_last_error'
         32        DO_ICALL                                         $21     
         33        SEND_VAR                                                 $21
         34        INIT_FCALL                                               'json_last_error_msg'
         35        DO_ICALL                                         $22     
         36        SEND_VAR                                                 $22
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.88 ms | 1396 KiB | 21 Q