3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements \Serializable { public function serialize() { $dt = new \DateTime(); return serialize(array($dt, serialize([$dt]))); } public function unserialize($serialized) { $a = unserialize($serialized); unserialize($a[1]); } } $a = new A(); $s = serialize($a); echo $s; $d = unserialize($s);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4R098
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $s, !2 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   18     1        NEW                                              $3      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   19     4        INIT_FCALL                                               'serialize'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !1, $6
   20     8        ECHO                                                     !1
   21     9        INIT_FCALL                                               'unserialize'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !2, $8
         13      > RETURN                                                   1

Class A:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4R098
function name:  serialize
number of ops:  14
compiled vars:  !0 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $1      'DateTime'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    8     3        INIT_FCALL                                               'serialize'
          4        INIT_ARRAY                                       ~4      !0
          5        INIT_FCALL                                               'serialize'
          6        INIT_ARRAY                                       ~5      !0
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                         $6      
          9        ADD_ARRAY_ELEMENT                                ~4      $6
         10        SEND_VAL                                                 ~4
         11        DO_ICALL                                         $7      
         12      > RETURN                                                   $7
    9    13*     > 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/4R098
function name:  unserialize
number of ops:  10
compiled vars:  !0 = $serialized, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   14     5        INIT_FCALL                                               'unserialize'
          6        FETCH_DIM_R                                      ~4      !1, 1
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
   15     9      > RETURN                                                   null

End of function unserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.89 ms | 1400 KiB | 17 Q