3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function __sleep() { return array('a', 'b'); } public function __wakeUp() { $this->__construct($this->a); } public function getA() { return $this->a; } public function getB() { return $this->b; } } class B implements \Serializable { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function serialize() { return serialize(array($this->a, $this->b)); } public function unserialize($serialized) { list($this->a, $this->b) = unserialize($serialized); $this->__construct($this->a); } public function getA() { return $this->a; } public function getB() { return $this->b; } } class C { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function getA() { return $this->a; } public function getB() { return $this->b; } } class D extends \ReflectionClass { } $a = new A('a'); $b = new B('b'); $c = new C('c'); $d = new D('stdClass'); $serializedA = serialize($a); $serializedB = serialize($b); $serializedC = serialize($c); $serializedD = serialize($d); var_dump($serializedA); var_dump($serializedB); var_dump($serializedC); var_dump($serializedD); var_dump(unserialize($serializedD));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  (null)
number of ops:  52
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d, !4 = $serializedA, !5 = $serializedB, !6 = $serializedC, !7 = $serializedD
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   DECLARE_CLASS                                            'b'
   96     1        NEW                                              $8      'A'
          2        SEND_VAL_EX                                              'a'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $8
   97     5        NEW                                              $11     'B'
          6        SEND_VAL_EX                                              'b'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $11
   98     9        NEW                                              $14     'C'
         10        SEND_VAL_EX                                              'c'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $14
   99    13        NEW                                              $17     'D'
         14        SEND_VAL_EX                                              'stdClass'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !3, $17
  101    17        INIT_FCALL                                               'serialize'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $20     
         20        ASSIGN                                                   !4, $20
  102    21        INIT_FCALL                                               'serialize'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $22     
         24        ASSIGN                                                   !5, $22
  103    25        INIT_FCALL                                               'serialize'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $24     
         28        ASSIGN                                                   !6, $24
  104    29        INIT_FCALL                                               'serialize'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $26     
         32        ASSIGN                                                   !7, $26
  106    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                                 
  107    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !5
         38        DO_ICALL                                                 
  108    39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !6
         41        DO_ICALL                                                 
  109    42        INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !7
         44        DO_ICALL                                                 
  111    45        INIT_FCALL                                               'var_dump'
         46        INIT_FCALL                                               'unserialize'
         47        SEND_VAR                                                 !7
         48        DO_ICALL                                         $32     
         49        SEND_VAR                                                 $32
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  __construct
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
   11     3        ASSIGN_OBJ                                               'b'
          4        OP_DATA                                                  !0
   12     5      > RETURN                                                   null

End of function __construct

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

End of function __sleep

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  __wakeUp
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_METHOD_CALL                                         '__construct'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      'a'
          3        SEND_FUNC_ARG                                            $0
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function __wakeup

Function geta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  getA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1      > RETURN                                                   ~0
   27     2*     > RETURN                                                   null

End of function geta

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  getB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'b'
          1      > RETURN                                                   ~0
   32     2*     > RETURN                                                   null

End of function getb

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/RBcrF
function name:  __construct
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
   43     3        ASSIGN_OBJ                                               'b'
          4        OP_DATA                                                  !0
   44     5      > 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/RBcrF
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'a'
          2        INIT_ARRAY                                       ~1      ~0
          3        FETCH_OBJ_R                                      ~2      'b'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   49     8*     > 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/RBcrF
function name:  unserialize
number of ops:  17
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   RECV                                             !0      
   53     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        FETCH_LIST_R                                     $2      $1, 0
          5        ASSIGN_OBJ                                               'a'
          6        OP_DATA                                                  $2
          7        FETCH_LIST_R                                     $4      $1, 1
          8        ASSIGN_OBJ                                               'b'
          9        OP_DATA                                                  $4
         10        FREE                                                     $1
   55    11        INIT_METHOD_CALL                                         '__construct'
         12        CHECK_FUNC_ARG                                           
         13        FETCH_OBJ_FUNC_ARG                               $6      'a'
         14        SEND_FUNC_ARG                                            $6
         15        DO_FCALL                                      0          
   56    16      > RETURN                                                   null

End of function unserialize

Function geta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  getA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1      > RETURN                                                   ~0
   61     2*     > RETURN                                                   null

End of function geta

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  getB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   FETCH_OBJ_R                                      ~0      'b'
          1      > RETURN                                                   ~0
   66     2*     > RETURN                                                   null

End of function getb

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/RBcrF
function name:  __construct
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   74     0  E >   RECV                                             !0      
   76     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
   77     3        ASSIGN_OBJ                                               'b'
          4        OP_DATA                                                  !0
   78     5      > RETURN                                                   null

End of function __construct

Function geta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  getA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1      > RETURN                                                   ~0
   83     2*     > RETURN                                                   null

End of function geta

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBcrF
function name:  getB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   87     0  E >   FETCH_OBJ_R                                      ~0      'b'
          1      > RETURN                                                   ~0
   88     2*     > RETURN                                                   null

End of function getb

End of class C.

Class D: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.77 ms | 1408 KiB | 19 Q