3v4l.org

run code in 500+ PHP versions simultaneously
<?php class F { private string $bar; public function __construct(private string $foo, string $bar){ $this->bar = $bar; } public function __sleep(): array { return array_keys(get_object_vars($this)); } public function getFoo():string { return $this->foo; } public function getBar():string { return $this->bar; } } $g = new F('this is a private variable', 'so is this'); class G extends F {} $s = serialize($g); var_export($s); $n = unserialize($s); echo \PHP_EOL; echo $n->getFoo(); echo \PHP_EOL; echo $n->getBar(); $h = new G('This is an extension', 'of the other one'); $s = serialize($h); echo \PHP_EOL; var_export($s); $n = unserialize($s); echo \PHP_EOL; echo $n->getFoo(); echo \PHP_EOL; echo $n->getBar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  (null)
number of ops:  50
compiled vars:  !0 = $g, !1 = $s, !2 = $n, !3 = $h
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $4      'F'
          1        SEND_VAL_EX                                                  'this+is+a+private+variable'
          2        SEND_VAL_EX                                                  'so+is+this'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $4
   23     5        INIT_FCALL                                                   'serialize'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $7      
          8        ASSIGN                                                       !1, $7
   24     9        INIT_FCALL                                                   'var_export'
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                                     
   25    12        INIT_FCALL                                                   'unserialize'
         13        SEND_VAR                                                     !1
         14        DO_ICALL                                             $10     
         15        ASSIGN                                                       !2, $10
   26    16        ECHO                                                         '%0A'
   27    17        INIT_METHOD_CALL                                             !2, 'getFoo'
         18        DO_FCALL                                          0  $12     
         19        ECHO                                                         $12
   28    20        ECHO                                                         '%0A'
   29    21        INIT_METHOD_CALL                                             !2, 'getBar'
         22        DO_FCALL                                          0  $13     
         23        ECHO                                                         $13
   31    24        NEW                                                  $14     'G'
         25        SEND_VAL_EX                                                  'This+is+an+extension'
         26        SEND_VAL_EX                                                  'of+the+other+one'
         27        DO_FCALL                                          0          
         28        ASSIGN                                                       !3, $14
   32    29        INIT_FCALL                                                   'serialize'
         30        SEND_VAR                                                     !3
         31        DO_ICALL                                             $17     
         32        ASSIGN                                                       !1, $17
   33    33        ECHO                                                         '%0A'
   34    34        INIT_FCALL                                                   'var_export'
         35        SEND_VAR                                                     !1
         36        DO_ICALL                                                     
   35    37        INIT_FCALL                                                   'unserialize'
         38        SEND_VAR                                                     !1
         39        DO_ICALL                                             $20     
         40        ASSIGN                                                       !2, $20
   36    41        ECHO                                                         '%0A'
   37    42        INIT_METHOD_CALL                                             !2, 'getFoo'
         43        DO_FCALL                                          0  $22     
         44        ECHO                                                         $22
   38    45        ECHO                                                         '%0A'
   39    46        INIT_METHOD_CALL                                             !2, 'getBar'
         47        DO_FCALL                                          0  $23     
         48        ECHO                                                         $23
         49      > RETURN                                                       1

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

End of function __construct

Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  __sleep
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                                   'array_keys'
          1        INIT_FCALL                                                   'get_object_vars'
          2        FETCH_THIS                                           ~0      
          3        SEND_VAL                                                     ~0
          4        DO_ICALL                                             $1      
          5        SEND_VAR                                                     $1
          6        DO_ICALL                                             $2      
          7        VERIFY_RETURN_TYPE                                           $2
          8      > RETURN                                                       $2
   11     9*       VERIFY_RETURN_TYPE                                           
         10*     > RETURN                                                       null

End of function __sleep

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  getFoo
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                          ~0      'foo'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   14     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getfoo

Function getbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  getBar
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                          ~0      'bar'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   17     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getbar

End of class F.

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

End of function __construct

Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  __sleep
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                                   'array_keys'
          1        INIT_FCALL                                                   'get_object_vars'
          2        FETCH_THIS                                           ~0      
          3        SEND_VAL                                                     ~0
          4        DO_ICALL                                             $1      
          5        SEND_VAR                                                     $1
          6        DO_ICALL                                             $2      
          7        VERIFY_RETURN_TYPE                                           $2
          8      > RETURN                                                       $2
   11     9*       VERIFY_RETURN_TYPE                                           
         10*     > RETURN                                                       null

End of function __sleep

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  getFoo
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                          ~0      'foo'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   14     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getfoo

Function getbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d6WN9
function name:  getBar
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                          ~0      'bar'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   17     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getbar

End of class G.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.44 ms | 1910 KiB | 18 Q