3v4l.org

run code in 300+ PHP versions simultaneously
<?php class obj 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]; } } $obj = new obj(); $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/TUKQ1
function name:  (null)
number of ops:  43
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                                            'obj'
   34     1        NEW                                              $5      'obj'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
   35     4        INIT_FCALL                                               'serialize'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !1, $8
   36     8        ECHO                                                     'first+serialize%3A+'
          9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   37    12        INIT_FCALL                                               'unserialize'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !2, $11
   38    16        ECHO                                                     'first+unserialize%3A+'
         17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   39    20        INIT_METHOD_CALL                                         !2, 'getExtraData'
         21        DO_FCALL                                      0          
   40    22        ECHO                                                     'with+extradata%3A+'
         23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
   41    26        INIT_FCALL                                               'serialize'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $16     
         29        ASSIGN                                                   !3, $16
   42    30        ECHO                                                     'second+serialize%3A+'
         31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                                 
   43    34        INIT_FCALL                                               'unserialize'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $19     
         37        ASSIGN                                                   !4, $19
   44    38        ECHO                                                     'second+unserialize%3A+'
         39        INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !4
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.12 ms | 1396 KiB | 19 Q