3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A extends \ReflectionClass implements \Serializable { public function serialize() { return serialize($this->name); } public function unserialize($serialized) { $this->__construct(unserialize($serialized)); } } $a = new A('ReflectionClass'); $serialized = serialize($a); var_dump($serialized); $unserialized = unserialize($serialized); var_dump($unserialized == $a); var_dump($unserialized === $a); var_dump($unserialized->getConstants());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HbhPR
function name:  (null)
number of ops:  30
compiled vars:  !0 = $a, !1 = $serialized, !2 = $unserialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a', 'reflectionclass'
   16     1        NEW                                              $3      'A'
          2        SEND_VAL_EX                                              'ReflectionClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   18     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   20     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   22    12        INIT_FCALL                                               'unserialize'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
   24    16        INIT_FCALL                                               'var_dump'
         17        IS_EQUAL                                         ~11     !2, !0
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                                 
   25    20        INIT_FCALL                                               'var_dump'
         21        IS_IDENTICAL                                     ~13     !2, !0
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                                 
   26    24        INIT_FCALL                                               'var_dump'
         25        INIT_METHOD_CALL                                         !2, 'getConstants'
         26        DO_FCALL                                      0  $15     
         27        SEND_VAR                                                 $15
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Class A:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HbhPR
function name:  serialize
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'name'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    8     5*     > RETURN                                                   null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HbhPR
function name:  unserialize
number of ops:  8
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_METHOD_CALL                                         '__construct'
          2        INIT_FCALL                                               'unserialize'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        SEND_VAR_NO_REF_EX                                       $1
          6        DO_FCALL                                      0          
   13     7      > RETURN                                                   null

End of function unserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.03 ms | 1400 KiB | 19 Q