3v4l.org

run code in 300+ PHP versions simultaneously
<?php class parentobj implements Serializable { protected $data; private $extradata; public function __construct() { $this->data = new temp("My private data"); } public function getData() { return $this->data; } public function setData($data) { $this->data = $data; } public function getExtraData(){ $this->extradata = array( 'data1','data2' ); } public function serialize() { return serialize(array( $this->data, $this->extradata, )); } public function unserialize($data) { $orgdata = unserialize($data); $this->data = $orgdata[0]; $this->extradata = $orgdata[1]; } } class childobj extends parentobj { protected $moredata; public function __construct() { return parent::__construct(); } public function getMoreData(){ $this->moredata= array( 'more_data1','more_data2' ); } public function serialize() { return serialize(array( $this->data, $this->moredata, parent::serialize(), )); } public function unserialize($data) { $orgdata = unserialize($data); $this->setData($orgdata[0]); $this->extradata = $orgdata[1]; $this->moredata = $orgdata[2]; parent::unserialize($orgdata[3]); } } class temp { protected $name; public function __construct($Name) { $this->name = $Name; } } $obj = new childobj(); $s = serialize($obj); echo 'first serialize: '; var_dump($s); $u = unserialize($s); echo 'first unserialize: '; var_dump($u); $u->getExtraData(); $u->getMoreData(); echo 'with extradata: '; var_dump($u); $s2 = serialize($u); echo 'second serialize: '; var_dump($s2); $u2 = unserialize($s2); echo 'second unserialize: '; var_dump($u2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  (null)
number of ops:  46
compiled vars:  !0 = $obj, !1 = $s, !2 = $u, !3 = $s2, !4 = $u2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'parentobj'
   38     1        DECLARE_CLASS                                            'childobj', 'parentobj'
   81     2        NEW                                              $5      'childobj'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
   82     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !1, $8
   83     9        ECHO                                                     'first+serialize%3A+'
         10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   84    13        INIT_FCALL                                               'unserialize'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !2, $11
   85    17        ECHO                                                     'first+unserialize%3A+'
         18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
   86    21        INIT_METHOD_CALL                                         !2, 'getExtraData'
         22        DO_FCALL                                      0          
   87    23        INIT_METHOD_CALL                                         !2, 'getMoreData'
         24        DO_FCALL                                      0          
   88    25        ECHO                                                     'with+extradata%3A+'
         26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
   89    29        INIT_FCALL                                               'serialize'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                         $17     
         32        ASSIGN                                                   !3, $17
   90    33        ECHO                                                     'second+serialize%3A+'
         34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                                 
   91    37        INIT_FCALL                                               'unserialize'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                         $20     
         40        ASSIGN                                                   !4, $20
   92    41        ECHO                                                     'second+unserialize%3A+'
         42        INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !4
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Class parentobj:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $1      'temp'
          1        SEND_VAL_EX                                              'My+private+data'
          2        DO_FCALL                                      0          
          3        ASSIGN_OBJ                                               'data'
          4        OP_DATA                                                  $1
    9     5      > RETURN                                                   null

End of function __construct

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

End of function getdata

Function setdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  setData
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ASSIGN_OBJ                                               'data'
          2        OP_DATA                                                  !0
   17     3      > RETURN                                                   null

End of function setdata

Function getextradata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  getExtraData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN_OBJ                                               'extradata'
   21     1        OP_DATA                                                  <array>
   23     2      > RETURN                                                   null

End of function getextradata

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'serialize'
   27     1        FETCH_OBJ_R                                      ~0      'data'
          2        INIT_ARRAY                                       ~1      ~0
   28     3        FETCH_OBJ_R                                      ~2      'extradata'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   30     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/cCdm0
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $data, !1 = $orgdata
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   32     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   33     5        FETCH_DIM_R                                      ~5      !1, 0
          6        ASSIGN_OBJ                                               'data'
          7        OP_DATA                                                  ~5
   34     8        FETCH_DIM_R                                      ~7      !1, 1
          9        ASSIGN_OBJ                                               'extradata'
         10        OP_DATA                                                  ~7
   35    11      > RETURN                                                   null

End of function unserialize

End of class parentobj.

Class childobj:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   45     3*     > RETURN                                                   null

End of function __construct

Function getmoredata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  getMoreData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   ASSIGN_OBJ                                               'moredata'
   49     1        OP_DATA                                                  <array>
   51     2      > RETURN                                                   null

End of function getmoredata

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cCdm0
function name:  serialize
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   INIT_FCALL                                               'serialize'
   56     1        FETCH_OBJ_R                                      ~0      'data'
          2        INIT_ARRAY                                       ~1      ~0
   57     3        FETCH_OBJ_R                                      ~2      'moredata'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
   59     5        INIT_STATIC_METHOD_CALL                                  'serialize'
          6        DO_FCALL                                      0  $3      
          7        ADD_ARRAY_ELEMENT                                ~1      $3
          8        SEND_VAL                                                 ~1
          9        DO_ICALL                                         $4      
         10      > RETURN                                                   $4
   61    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/cCdm0
function name:  unserialize
number of ops:  22
compiled vars:  !0 = $data, !1 = $orgdata
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   RECV                                             !0      
   63     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   64     5        INIT_METHOD_CALL                                         'setData'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_DIM_FUNC_ARG                               $4      !1, 0
          8        SEND_FUNC_ARG                                            $4
          9        DO_FCALL                                      0          
   65    10        FETCH_DIM_R                                      ~7      !1, 1
         11        ASSIGN_OBJ                                               'extradata'
         12        OP_DATA                                                  ~7
   66    13        FETCH_DIM_R                                      ~9      !1, 2
         14        ASSIGN_OBJ                                               'moredata'
         15        OP_DATA                                                  ~9
   68    16        INIT_STATIC_METHOD_CALL                                  'unserialize'
         17        CHECK_FUNC_ARG                                           
         18        FETCH_DIM_FUNC_ARG                               $10     !1, 3
         19        SEND_FUNC_ARG                                            $10
         20        DO_FCALL                                      0          
   69    21      > RETURN                                                   null

End of function unserialize

End of class childobj.

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

End of function __construct

End of class temp.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.31 ms | 1408 KiB | 19 Q