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), $so); $result = @json_encode($arr); 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/EVdZT
function name:  (null)
number of ops:  35
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        ADD_ARRAY_ELEMENT                                ~14     ~15
         17        ADD_ARRAY_ELEMENT                                ~14     !0
         18        ASSIGN                                                   !2, ~14
   11    19        BEGIN_SILENCE                                    ~17     
         20        INIT_FCALL                                               'json_encode'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $18     
         23        END_SILENCE                                              ~17
         24        ASSIGN                                                   !3, $18
   13    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        INIT_FCALL                                               'json_last_error'
         28        DO_ICALL                                         $20     
         29        SEND_VAR                                                 $20
         30        INIT_FCALL                                               'json_last_error_msg'
         31        DO_ICALL                                         $21     
         32        SEND_VAR                                                 $21
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.54 ms | 1396 KiB | 21 Q