3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a = array(); public function __construct() { $this->a[] = new B(1); $this->a[] = new B(2); } } class B implements Serializable { public $b; public function __construct($c) { $this->b = new C($c); } public function serialize() { return serialize(clone $this->b); } public function unserialize($data) { $this->b = unserialize($data); } } class C { public $c; public function __construct($c) { $this->c = $c; } } $a = unserialize(serialize(new A())); print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YKM7s
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                            'b'
   43     1        INIT_FCALL                                               'unserialize'
          2        INIT_FCALL                                               'serialize'
          3        NEW                                              $1      'A'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !0, $4
   44    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YKM7s
function name:  __construct
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'B'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        FETCH_OBJ_W                                      $0      'a'
          4        ASSIGN_DIM                                               $0
          5        OP_DATA                                                  $2
    9     6        NEW                                              $6      'B'
          7        SEND_VAL_EX                                              2
          8        DO_FCALL                                      0          
          9        FETCH_OBJ_W                                      $4      'a'
         10        ASSIGN_DIM                                               $4
         11        OP_DATA                                                  $6
   10    12      > RETURN                                                   null

End of function __construct

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YKM7s
function name:  __construct
number of ops:  7
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        NEW                                              $2      'C'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN_OBJ                                               'b'
          5        OP_DATA                                                  $2
   20     6      > RETURN                                                   null

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YKM7s
function name:  serialize
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'b'
          2        CLONE                                            ~1      ~0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
   25     6*     > RETURN                                                   null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YKM7s
function name:  unserialize
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   29     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN_OBJ                                               'b'
          5        OP_DATA                                                  $2
   30     6      > RETURN                                                   null

End of function unserialize

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YKM7s
function name:  __construct
number of ops:  4
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   39     1        ASSIGN_OBJ                                               'c'
          2        OP_DATA                                                  !0
   40     3      > RETURN                                                   null

End of function __construct

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.87 ms | 1400 KiB | 19 Q