3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SerializableObject implements JsonSerializable { public function jsonSerialize() { return array('foo' => 'bar'); } } class MultipleNonCircularReference implements JsonSerializable { public function jsonSerialize() { $obj = new SerializableObject(); return array('a' => 123); } } var_dump(json_encode(new SerializableObject()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h1T6l
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'serializableobject'
   11     1        DECLARE_CLASS                                            'multiplenoncircularreference'
   19     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'json_encode'
          4        NEW                                              $0      'SerializableObject'
          5        DO_FCALL                                      0          
          6        SEND_VAR                                                 $0
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class SerializableObject:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h1T6l
function name:  jsonSerialize
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   <array>
    7     1*     > RETURN                                                   null

End of function jsonserialize

End of class SerializableObject.

Class MultipleNonCircularReference:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h1T6l
function name:  jsonSerialize
number of ops:  5
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'SerializableObject'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3      > RETURN                                                   <array>
   16     4*     > RETURN                                                   null

End of function jsonserialize

End of class MultipleNonCircularReference.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.2 ms | 1395 KiB | 17 Q