3v4l.org

run code in 300+ PHP versions simultaneously
<?php class logger { function __construct() { print "logger constructing\n"; } function __wakeup() { print "logger wakeup\n"; } function __destruct() { print "logger destruct\n"; } } class obj { var $prop; function __wakeup() { $this->prop = 'awake'; } } $a = []; $a[] = new stdclass; $a[0]->one = new logger; $a[] = new obj; $a[1]->prop =& $a[0]; $a[] =& $a[1]->one; var_dump(serialize($a)); $x = 'a:4:{i:0;O:8:"stdClass":1:{i:0;O:6:"logger":0:{}}i:1;O:3:"obj":1:{s:4:"prop";R:2;}i:2;R:3}'; $y = unserialize($x); var_dump($y);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2mj7v
function name:  (null)
number of ops:  39
compiled vars:  !0 = $a, !1 = $x, !2 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, <array>
   22     1        NEW                                              $5      'stdclass'
          2        DO_FCALL                                      0          
          3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  $5
   23     5        NEW                                              $9      'logger'
          6        DO_FCALL                                      0          
          7        FETCH_DIM_W                                      $7      !0, 0
          8        ASSIGN_OBJ                                               $7, 'one'
          9        OP_DATA                                                  $9
   24    10        NEW                                              $12     'obj'
         11        DO_FCALL                                      0          
         12        ASSIGN_DIM                                               !0
         13        OP_DATA                                                  $12
   25    14        FETCH_DIM_W                                      $16     !0, 0
         15        MAKE_REF                                         $17     $16
         16        FETCH_DIM_W                                      $14     !0, 1
         17        ASSIGN_OBJ_REF                                           $14, 'prop'
         18        OP_DATA                                                  $17
   26    19        FETCH_DIM_W                                      $19     !0, 1
         20        FETCH_OBJ_W                                      $20     $19, 'one'
         21        MAKE_REF                                         $21     $20
         22        FETCH_DIM_W                                      $18     !0
         23        ASSIGN_REF                                               $18, $21
   27    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'serialize'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                         $23     
         28        SEND_VAR                                                 $23
         29        DO_ICALL                                                 
   29    30        ASSIGN                                                   !1, 'a%3A4%3A%7Bi%3A0%3BO%3A8%3A%22stdClass%22%3A1%3A%7Bi%3A0%3BO%3A6%3A%22logger%22%3A0%3A%7B%7D%7Di%3A1%3BO%3A3%3A%22obj%22%3A1%3A%7Bs%3A4%3A%22prop%22%3BR%3A2%3B%7Di%3A2%3BR%3A3%7D'
   30    31        INIT_FCALL                                               'unserialize'
         32        SEND_VAR                                                 !1
         33        DO_ICALL                                         $26     
         34        ASSIGN                                                   !2, $26
   32    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Class logger:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2mj7v
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'logger+constructing%0A'
    6     1      > RETURN                                                   null

End of function __construct

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2mj7v
function name:  __wakeup
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'logger+wakeup%0A'
    9     1      > RETURN                                                   null

End of function __wakeup

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2mj7v
function name:  __destruct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'logger+destruct%0A'
   12     1      > RETURN                                                   null

End of function __destruct

End of class logger.

Class obj:
Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2mj7v
function name:  __wakeup
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN_OBJ                                               'prop'
          1        OP_DATA                                                  'awake'
   18     2      > RETURN                                                   null

End of function __wakeup

End of class obj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.02 ms | 1400 KiB | 19 Q