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, 0, 5); 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/e8ufc
function name:  (null)
number of ops:  37
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        SEND_VAL                                                 0
         23        SEND_VAL                                                 5
         24        DO_ICALL                                         $18     
         25        END_SILENCE                                              ~17
         26        ASSIGN                                                   !3, $18
   13    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !3
         29        INIT_FCALL                                               'json_last_error'
         30        DO_ICALL                                         $20     
         31        SEND_VAR                                                 $20
         32        INIT_FCALL                                               'json_last_error_msg'
         33        DO_ICALL                                         $21     
         34        SEND_VAR                                                 $21
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.3 ms | 1388 KiB | 21 Q