3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements \Serializable { public function serialize() { $s = new \stdClass(); $s->id = 1; var_dump($s); return serialize($s); } public function unserialize($s) { } } class B extends A { public function serialize() { $p = parent::serialize(); $s = unserialize($p); $s->foo = 'bar'; $s2 = serialize($s); var_dump($p, $s, $s2); // $s2 = 'r:2' //var_dump(unserialize($s2)); // will throw error as can't unserialize die; //return serialize($s); } } $b = new B; serialize($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fuI8h
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'a'
   16     1        DECLARE_CLASS                                            'b', 'a'
   31     2        NEW                                              $1      'B'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   32     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function unserialize

End of class A.

Class B:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/fuI8h
function name:  serialize
number of ops:  20
compiled vars:  !0 = $p, !1 = $s, !2 = $s2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'serialize'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   21     3        INIT_FCALL                                               'unserialize'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
   22     7        ASSIGN_OBJ                                               !1, 'foo'
          8        OP_DATA                                                  'bar'
   23     9        INIT_FCALL                                               'serialize'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !2, $8
   24    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !1
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
   26    18      > EXIT                                                     
   28    19*     > RETURN                                                   null

End of function serialize

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.29 ms | 1400 KiB | 19 Q