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; } } $a = new A('a'); $b = new B('b'); $c = new C('c'); $serializedA = serialize($a); $serializedB = serialize($b); $serializedC = serialize($c); var_dump($serializedA); var_dump($serializedB); var_dump($serializedC);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p8Mr9
function name:  (null)
number of ops:  35
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $serializedA, !4 = $serializedB, !5 = $serializedC
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   DECLARE_CLASS                                            'b'
   91     1        NEW                                              $6      'A'
          2        SEND_VAL_EX                                              'a'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $6
   92     5        NEW                                              $9      'B'
          6        SEND_VAL_EX                                              'b'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $9
   93     9        NEW                                              $12     'C'
         10        SEND_VAL_EX                                              'c'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
   94    13        INIT_FCALL                                               'serialize'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $15     
         16        ASSIGN                                                   !3, $15
   95    17        INIT_FCALL                                               'serialize'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $17     
         20        ASSIGN                                                   !4, $17
   96    21        INIT_FCALL                                               'serialize'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !5, $19
   98    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                                 
   99    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                                 
  100    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !5
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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/p8Mr9
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.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.84 ms | 1408 KiB | 19 Q