3v4l.org

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

Class A:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B4G8u
function name:  jsonSerialize
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN_OBJ                                               'className'
          1        OP_DATA                                                  'A'
    8     2        FETCH_THIS                                       ~1      
          3      > RETURN                                                   ~1
    9     4*     > RETURN                                                   null

End of function jsonserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.81 ms | 1395 KiB | 17 Q