3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public $value; function __construct($value){ $this->value = $value; } function __wakeup() { if($this->value instanceof C) $this->value = C::$instance; } } class C { static public $instance; } C::$instance = new C; $A = array( new B(C::$instance), new B(C::$instance), new B(C::$instance) ); var_dump($A); var_dump($A); $A = unserialize(serialize($A)); var_dump($A);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RG5T5
function name:  (null)
number of ops:  40
compiled vars:  !0 = $A
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN_STATIC_PROP                                       'instance', 'C'
          3        OP_DATA                                                  $2
   18     4        NEW                                              $4      'B'
          5        CHECK_FUNC_ARG                                           
          6        FETCH_STATIC_PROP_FUNC_ARG   unknown             $5      'instance'
          7        SEND_FUNC_ARG                                            $5
          8        DO_FCALL                                      0          
          9        INIT_ARRAY                                       ~7      $4
         10        NEW                                              $8      'B'
         11        CHECK_FUNC_ARG                                           
         12        FETCH_STATIC_PROP_FUNC_ARG   unknown             $9      'instance'
         13        SEND_FUNC_ARG                                            $9
         14        DO_FCALL                                      0          
         15        ADD_ARRAY_ELEMENT                                ~7      $8
         16        NEW                                              $11     'B'
         17        CHECK_FUNC_ARG                                           
         18        FETCH_STATIC_PROP_FUNC_ARG   unknown             $12     'instance'
         19        SEND_FUNC_ARG                                            $12
         20        DO_FCALL                                      0          
         21        ADD_ARRAY_ELEMENT                                ~7      $11
         22        ASSIGN                                                   !0, ~7
   20    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
   21    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
   22    29        INIT_FCALL                                               'unserialize'
         30        INIT_FCALL                                               'serialize'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $17     
         33        SEND_VAR                                                 $17
         34        DO_ICALL                                         $18     
         35        ASSIGN                                                   !0, $18
   23    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !0
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

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

End of function __construct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/RG5T5
function name:  __wakeup
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'value'
          1        INSTANCEOF                                               ~0, 'C'
          2      > JMPZ                                                     ~1, ->6
   10     3    >   FETCH_STATIC_PROP_R          unknown             ~3      'instance'
          4        ASSIGN_OBJ                                               'value'
          5        OP_DATA                                                  ~3
   11     6    > > RETURN                                                   null

End of function __wakeup

End of class B.

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.5 ms | 1400 KiB | 19 Q