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() { $serialized = serialize(clone $this->b); print_r($serialized);echo "\n"; return $serialized; } public function unserialize($data) { print_r($data);echo "\n"; $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/7ZMKs
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'
   46     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
   47    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/7ZMKs
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/7ZMKs
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/7ZMKs
function name:  serialize
number of ops:  12
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~1      'b'
          2        CLONE                                            ~2      ~1
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
   25     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9        ECHO                                                     '%0A'
   26    10      > RETURN                                                   !0
   27    11*     > 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/7ZMKs
function name:  unserialize
number of ops:  11
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   31     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
          4        ECHO                                                     '%0A'
   32     5        INIT_FCALL                                               'unserialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        ASSIGN_OBJ                                               'b'
          9        OP_DATA                                                  $3
   33    10      > 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/7ZMKs
function name:  __construct
number of ops:  4
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        ASSIGN_OBJ                                               'c'
          2        OP_DATA                                                  !0
   43     3      > RETURN                                                   null

End of function __construct

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.16 ms | 1400 KiB | 19 Q