3v4l.org

run code in 300+ PHP versions simultaneously
<?php class parentobj implements Serializable { private $data; protected $extradata; public function __construct() { $this->data = "My private data"; } public function getData() { return $this->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 { public function getExtraData(){ $this->extradata = array( 'datachild1','datachild2' ); } 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]; } } $obj = new childobj(); $s = serialize($obj); echo 'first serialize: '; var_dump($s); $u = unserialize($s); echo 'first unserialize: '; var_dump($u); $u->getExtraData(); 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/VMm7C
function name:  (null)
number of ops:  44
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'
   34     1        DECLARE_CLASS                                            'childobj', 'parentobj'
   55     2        NEW                                              $5      'childobj'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
   56     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !1, $8
   57     9        ECHO                                                     'first+serialize%3A+'
         10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   58    13        INIT_FCALL                                               'unserialize'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !2, $11
   59    17        ECHO                                                     'first+unserialize%3A+'
         18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
   60    21        INIT_METHOD_CALL                                         !2, 'getExtraData'
         22        DO_FCALL                                      0          
   61    23        ECHO                                                     'with+extradata%3A+'
         24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                                 
   62    27        INIT_FCALL                                               'serialize'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !3, $16
   63    31        ECHO                                                     'second+serialize%3A+'
         32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                                 
   64    35        INIT_FCALL                                               'unserialize'
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $19     
         38        ASSIGN                                                   !4, $19
   65    39        ECHO                                                     'second+unserialize%3A+'
         40        INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

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

End of function unserialize

End of class parentobj.

Class childobj:
Function getextradata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VMm7C
function name:  getExtraData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   ASSIGN_OBJ                                               'extradata'
   38     1        OP_DATA                                                  <array>
   40     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/VMm7C
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   INIT_FCALL                                               'serialize'
   44     1        FETCH_OBJ_R                                      ~0      'data'
          2        INIT_ARRAY                                       ~1      ~0
   45     3        FETCH_OBJ_R                                      ~2      'extradata'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   47     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/VMm7C
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $data, !1 = $orgdata
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
   49     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   50     5        FETCH_DIM_R                                      ~5      !1, 0
          6        ASSIGN_OBJ                                               'data'
          7        OP_DATA                                                  ~5
   51     8        FETCH_DIM_R                                      ~7      !1, 1
          9        ASSIGN_OBJ                                               'extradata'
         10        OP_DATA                                                  ~7
   52    11      > RETURN                                                   null

End of function unserialize

End of class childobj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.65 ms | 1404 KiB | 19 Q