3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $b = 'foo'; } class B extends A { public function __sleep() { return array('b'); } } class C extends A implements Serializable { public function unserialize($serialized) { /*... */ } public function serialize() { $b = new ReflectionProperty('A', 'b'); $b->setAccessible(true); return serialize(array('b' => $b->getValue($this))); } } var_dump(serialize(new A())); var_dump(serialize(new B())); var_dump(serialize(new C())); var_dump((array) new C());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mjpp4
function name:  (null)
number of ops:  32
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_CLASS                                            'c', 'a'
   27     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'serialize'
          3        NEW                                              $0      'A'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
   28     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'serialize'
         11        NEW                                              $4      'B'
         12        DO_FCALL                                      0          
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                         $6      
         15        SEND_VAR                                                 $6
         16        DO_ICALL                                                 
   29    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'serialize'
         19        NEW                                              $8      'C'
         20        DO_FCALL                                      0          
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                         $10     
         23        SEND_VAR                                                 $10
         24        DO_ICALL                                                 
   30    25        INIT_FCALL                                               'var_dump'
         26        NEW                                              $12     'C'
         27        DO_FCALL                                      0          
         28        CAST                                          7  ~14     $12
         29        SEND_VAL                                                 ~14
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Class A: [no user functions]
Class B:
Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mjpp4
function name:  __sleep
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   <array>
   13     1*     > RETURN                                                   null

End of function __sleep

End of class B.

Class C:
Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mjpp4
function name:  unserialize
number of ops:  2
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function unserialize

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mjpp4
function name:  serialize
number of ops:  18
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'ReflectionProperty'
          1        SEND_VAL_EX                                              'A'
          2        SEND_VAL_EX                                              'b'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   22     5        INIT_METHOD_CALL                                         !0, 'setAccessible'
          6        SEND_VAL_EX                                              <true>
          7        DO_FCALL                                      0          
   23     8        INIT_FCALL                                               'serialize'
          9        INIT_METHOD_CALL                                         !0, 'getValue'
         10        FETCH_THIS                                       $5      
         11        SEND_VAR_EX                                              $5
         12        DO_FCALL                                      0  $6      
         13        INIT_ARRAY                                       ~7      $6, 'b'
         14        SEND_VAL                                                 ~7
         15        DO_ICALL                                         $8      
         16      > RETURN                                                   $8
   24    17*     > RETURN                                                   null

End of function serialize

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.12 ms | 1400 KiB | 17 Q