3v4l.org

run code in 300+ PHP versions simultaneously
<?php class D { } class E extends D { public $D; } class F extends D { public $D; public $E; } class A implements Serializable { public function serialize () { $serialized = array(); foreach($this as $prop => $val) { $serialized[$prop] = $val; } return serialize($serialized); //return serialize(get_object_vars($this)); } function unserialize($serialized) { foreach(unserialize($serialized) as $prop => $val) { $this->$prop = $val; } return true; } } class B extends A { public $A; } class C extends A { public $A; public $B; } $oC = new C(); $oC->A = new A(); $oC->B = new B(); $oC->B->A = $oC->A; $oF = new F(); $oF->D = new D(); $oF->E = new E(); $oF->E->D = $oF->D; $ser = serialize($oC); echo $ser, "\n"; $ser = serialize($oF); echo $ser, "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xa3vX
function name:  (null)
number of ops:  46
compiled vars:  !0 = $oC, !1 = $oF, !2 = $ser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   DECLARE_CLASS                                            'a'
   41     1        DECLARE_CLASS                                            'b', 'a'
   46     2        DECLARE_CLASS                                            'c', 'a'
   52     3        NEW                                              $3      'C'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   53     6        NEW                                              $7      'A'
          7        DO_FCALL                                      0          
          8        ASSIGN_OBJ                                               !0, 'A'
          9        OP_DATA                                                  $7
   54    10        NEW                                              $10     'B'
         11        DO_FCALL                                      0          
         12        ASSIGN_OBJ                                               !0, 'B'
         13        OP_DATA                                                  $10
   55    14        FETCH_OBJ_R                                      ~14     !0, 'A'
         15        FETCH_OBJ_W                                      $12     !0, 'B'
         16        ASSIGN_OBJ                                               $12, 'A'
         17        OP_DATA                                                  ~14
   57    18        NEW                                              $15     'F'
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !1, $15
   58    21        NEW                                              $19     'D'
         22        DO_FCALL                                      0          
         23        ASSIGN_OBJ                                               !1, 'D'
         24        OP_DATA                                                  $19
   59    25        NEW                                              $22     'E'
         26        DO_FCALL                                      0          
         27        ASSIGN_OBJ                                               !1, 'E'
         28        OP_DATA                                                  $22
   60    29        FETCH_OBJ_R                                      ~26     !1, 'D'
         30        FETCH_OBJ_W                                      $24     !1, 'E'
         31        ASSIGN_OBJ                                               $24, 'D'
         32        OP_DATA                                                  ~26
   62    33        INIT_FCALL                                               'serialize'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $27     
         36        ASSIGN                                                   !2, $27
   64    37        ECHO                                                     !2
         38        ECHO                                                     '%0A'
   66    39        INIT_FCALL                                               'serialize'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                         $29     
         42        ASSIGN                                                   !2, $29
   68    43        ECHO                                                     !2
         44        ECHO                                                     '%0A'
         45      > RETURN                                                   1

Class D: [no user functions]
Class E: [no user functions]
Class F: [no user functions]
Class A:
Function serialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/Xa3vX
function name:  serialize
number of ops:  14
compiled vars:  !0 = $serialized, !1 = $val, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, <array>
   24     1        FETCH_THIS                                       ~4      
          2      > FE_RESET_R                                       $5      ~4, ->8
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->8
          4    >   ASSIGN                                                   !2, ~6
   25     5        ASSIGN_DIM                                               !0, !2
          6        OP_DATA                                                  !1
   24     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $5
   27     9        INIT_FCALL                                               'serialize'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $9      
         12      > RETURN                                                   $9
   30    13*     > RETURN                                                   null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/Xa3vX
function name:  unserialize
number of ops:  13
compiled vars:  !0 = $serialized, !1 = $val, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4      > FE_RESET_R                                       $4      $3, ->10
          5    > > FE_FETCH_R                                       ~5      $4, !1, ->10
          6    >   ASSIGN                                                   !2, ~5
   35     7        ASSIGN_OBJ                                               !2
          8        OP_DATA                                                  !1
   34     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $4
   37    11      > RETURN                                                   <true>
   38    12*     > RETURN                                                   null

End of function unserialize

End of class A.

Class B: [no user functions]
Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.03 ms | 1400 KiB | 17 Q