3v4l.org

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

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

End of function jsonserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.52 ms | 1014 KiB | 15 Q