3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test implements JsonSerializable { public $a = 2; public function JsonSerialize() { return array('test'=>array('c' => $this)); } } var_dump(json_encode(new test(), JSON_PARTIAL_OUTPUT_ON_ERROR)); var_dump(json_last_error_msg());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbKSd
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'test'
   10     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'json_encode'
          3        NEW                                              $0      'test'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        SEND_VAL                                                 512
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   11    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'json_last_error_msg'
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class test:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbKSd
function name:  JsonSerialize
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_THIS                                       ~0      
          1        INIT_ARRAY                                       ~1      ~0, 'c'
          2        INIT_ARRAY                                       ~2      ~1, 'test'
          3      > RETURN                                                   ~2
    7     4*     > RETURN                                                   null

End of function jsonserialize

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.21 ms | 1386 KiB | 19 Q