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

End of function serialize

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158 ms | 1392 KiB | 17 Q