3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ObjectWithReferences { protected $var1; protected $var2; protected $var3; public function __construct() { $this->var1 = new StdClass(); $this->var2 = null; $this->var3 = $this->var1; } } class WrapperObject implements Serializable { static $tempstorage; protected $obj; public function setObject($obj) { $this->obj = $obj; } public function getObject() { if (is_string($this->obj)) { $this->obj = unserialize($this->obj); } return $this->obj; } public function serialize() { return serialize($this->obj); } public function unserialize($serialized) { $this->obj = $serialized; } } $owr = new ObjectWithReferences(); $wrapper = new WrapperObject(); $wrapper->setObject($owr); var_dump($wrapper->getObject()); $wrapper = unserialize(serialize($wrapper)); var_dump($wrapper->getObject());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4KX9
function name:  (null)
number of ops:  28
compiled vars:  !0 = $owr, !1 = $wrapper
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_CLASS                                            'wrapperobject'
   44     1        NEW                                              $2      'ObjectWithReferences'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   45     4        NEW                                              $5      'WrapperObject'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   47     7        INIT_METHOD_CALL                                         !1, 'setObject'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   48    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !1, 'getObject'
         12        DO_FCALL                                      0  $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                                 
   50    15        INIT_FCALL                                               'unserialize'
         16        INIT_FCALL                                               'serialize'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $11     
         19        SEND_VAR                                                 $11
         20        DO_ICALL                                         $12     
         21        ASSIGN                                                   !1, $12
   52    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !1, 'getObject'
         24        DO_FCALL                                      0  $14     
         25        SEND_VAR                                                 $14
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class ObjectWithReferences:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4KX9
function name:  __construct
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $1      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'var1'
          3        OP_DATA                                                  $1
   10     4        ASSIGN_OBJ                                               'var2'
          5        OP_DATA                                                  null
   11     6        FETCH_OBJ_R                                      ~5      'var1'
          7        ASSIGN_OBJ                                               'var3'
          8        OP_DATA                                                  ~5
   12     9      > RETURN                                                   null

End of function __construct

End of class ObjectWithReferences.

Class WrapperObject:
Function setobject:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4KX9
function name:  setObject
number of ops:  4
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ASSIGN_OBJ                                               'obj'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function setobject

Function getobject:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/d4KX9
function name:  getObject
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'obj'
          1        TYPE_CHECK                                   64          ~0
          2      > JMPZ                                                     ~1, ->9
   28     3    >   INIT_FCALL                                               'unserialize'
          4        FETCH_OBJ_R                                      ~3      'obj'
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                         $4      
          7        ASSIGN_OBJ                                               'obj'
          8        OP_DATA                                                  $4
   31     9    >   FETCH_OBJ_R                                      ~5      'obj'
         10      > RETURN                                                   ~5
   32    11*     > RETURN                                                   null

End of function getobject

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4KX9
function name:  serialize
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'obj'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   36     5*     > 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/d4KX9
function name:  unserialize
number of ops:  4
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
   39     1        ASSIGN_OBJ                                               'obj'
          2        OP_DATA                                                  !0
   40     3      > RETURN                                                   null

End of function unserialize

End of class WrapperObject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.97 ms | 1400 KiB | 19 Q