3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ObjectWithReferences { protected $var1; protected $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() { for ($i = 0; $i < 15; ++$i) { var_dump(serialize(new \stdClass())); } return serialize($this->obj); } public function unserialize($serialized) { $this->obj = unserialize($serialized); } } $wrapper = new WrapperObject(new ObjectWithReferences()); var_dump($wrapper->getObject()); $serialized = serialize($wrapper); var_dump($serialized); $wrapper = unserialize($serialized);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XaTAq
function name:  (null)
number of ops:  24
compiled vars:  !0 = $wrapper, !1 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                            'wrapperobject'
   39     1        NEW                                              $2      'WrapperObject'
          2        NEW                                              $3      'ObjectWithReferences'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $3
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   41     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'getObject'
          9        DO_FCALL                                      0  $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
   43    12        INIT_FCALL                                               'serialize'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !1, $9
   44    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
   46    19        INIT_FCALL                                               'unserialize'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $12     
         22        ASSIGN                                                   !0, $12
         23      > RETURN                                                   1

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

End of function getobject

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
Branch analysis from position: 2
filename:       /in/XaTAq
function name:  serialize
number of ops:  19
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->11
   27     2    >   INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'serialize'
          4        NEW                                              $2      'stdClass'
          5        DO_FCALL                                      0          
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   26    10        PRE_INC                                                  !0
         11    >   IS_SMALLER                                               !0, 15
         12      > JMPNZ                                                    ~7, ->2
   30    13    >   INIT_FCALL                                               'serialize'
         14        FETCH_OBJ_R                                      ~8      'obj'
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                         $9      
         17      > RETURN                                                   $9
   31    18*     > 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/XaTAq
function name:  unserialize
number of ops:  7
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN_OBJ                                               'obj'
          5        OP_DATA                                                  $2
   35     6      > RETURN                                                   null

End of function unserialize

End of class WrapperObject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.61 ms | 1404 KiB | 19 Q