3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ObjectWithReferences { private $var1; private $var2; public function __construct() { $this->var1 = new StdClass(); $this->var2 = $this->var1; } } class WrapperObject implements Serializable { private $obj; public function __construct($obj) { $this->obj = $obj; } public function getObject() { return $this->obj; } public function serialize() { return serialize($this->obj); } public function unserialize($serialized) { unserialize('O:8:"stdClass":0:{}'); $this->obj = unserialize($serialized); } } $wrapper = new WrapperObject(new ObjectWithReferences()); 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/JbqmH
function name:  (null)
number of ops:  25
compiled vars:  !0 = $wrapper
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                                'wrapperobject'
   37     1        NEW                                                  $1      'WrapperObject'
          2        NEW                                                  $2      'ObjectWithReferences'
          3        DO_FCALL                                          0          
          4        SEND_VAR_NO_REF_EX                                           $2
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !0, $1
   39     7        INIT_FCALL                                                   'var_dump'
          8        INIT_METHOD_CALL                                             !0, 'getObject'
          9        DO_FCALL                                          0  $6      
         10        SEND_VAR                                                     $6
         11        DO_ICALL                                                     
   41    12        INIT_FCALL                                                   'unserialize'
         13        INIT_FCALL                                                   'serialize'
         14        SEND_VAR                                                     !0
         15        DO_ICALL                                             $8      
         16        SEND_VAR                                                     $8
         17        DO_ICALL                                             $9      
         18        ASSIGN                                                       !0, $9
   43    19        INIT_FCALL                                                   'var_dump'
         20        INIT_METHOD_CALL                                             !0, 'getObject'
         21        DO_FCALL                                          0  $11     
         22        SEND_VAR                                                     $11
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

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

End of function __construct

End of class ObjectWithReferences.

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

End of function __construct

Function getobject:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbqmH
function name:  getObject
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                          ~0      'obj'
          1      > RETURN                                                       ~0
   24     2*     > 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/JbqmH
function name:  serialize
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'obj'
          2        SEND_VAL                                                     ~0
          3        DO_ICALL                                             $1      
          4      > RETURN                                                       $1
   28     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/JbqmH
function name:  unserialize
number of ops:  10
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   RECV                                                 !0      
   31     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAL                                                     'O%3A8%3A%22stdClass%22%3A0%3A%7B%7D'
          3        DO_ICALL                                                     
   32     4        INIT_FCALL                                                   'unserialize'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $3      
          7        ASSIGN_OBJ                                                   'obj'
          8        OP_DATA                                                      $3
   33     9      > RETURN                                                       null

End of function unserialize

End of class WrapperObject.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
179.73 ms | 3142 KiB | 16 Q