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)); $this->name = 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/kjL4u
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'
   17     1        NEW                                              $3      'A'
          2        SEND_VAL_EX                                              'ReflectionClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   19     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   21     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   23    12        INIT_FCALL                                               'unserialize'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
   25    16        INIT_FCALL                                               'var_dump'
         17        IS_EQUAL                                         ~11     !2, !0
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                                 
   26    20        INIT_FCALL                                               'var_dump'
         21        IS_IDENTICAL                                     ~13     !2, !0
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                                 
   27    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/kjL4u
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/kjL4u
function name:  unserialize
number of ops:  7
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN_OBJ                                               'name'
          5        OP_DATA                                                  $2
   14     6      > RETURN                                                   null

End of function unserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.79 ms | 1400 KiB | 19 Q