3v4l.org

run code in 300+ 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'); $s = serialize($g); 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/ApUpq
function name:  (null)
number of ops:  25
compiled vars:  !0 = $g, !1 = $s, !2 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $3      'F'
          1        SEND_VAL_EX                                              'this+is+a+private+variable'
          2        SEND_VAL_EX                                              'so+is+this'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   21     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   22     9        INIT_FCALL                                               'var_export'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   23    12        INIT_FCALL                                               'unserialize'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
   24    16        ECHO                                                     '%0A'
   25    17        INIT_METHOD_CALL                                         !2, 'getFoo'
         18        DO_FCALL                                      0  $11     
         19        ECHO                                                     $11
   26    20        ECHO                                                     '%0A'
   27    21        INIT_METHOD_CALL                                         !2, 'getBar'
         22        DO_FCALL                                      0  $12     
         23        ECHO                                                     $12
         24      > RETURN                                                   1

Class F:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ApUpq
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/ApUpq
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/ApUpq
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/ApUpq
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.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
122.16 ms | 1442 KiB | 18 Q