3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public $name = "admin"; } class UserCouple implements Serializable { public $user1; public $user2; public function serialize() { return serialize(array(42, serialize(array($this->user1, $this->user2)))); } public function unserialize($serialized) { list($_, $subSerialized) = unserialize($serialized); list($this->user1, $this->user2) = unserialize($subSerialized); } } $user = new User(); $couple = new UserCouple(); $couple->user1 = $user; $couple->user2 = $user; var_dump($couple); var_dump(unserialize(serialize($couple)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BXuv8
function name:  (null)
number of ops:  24
compiled vars:  !0 = $user, !1 = $couple
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                            'usercouple'
   24     1        NEW                                              $2      'User'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   25     4        NEW                                              $5      'UserCouple'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   26     7        ASSIGN_OBJ                                               !1, 'user1'
          8        OP_DATA                                                  !0
   27     9        ASSIGN_OBJ                                               !1, 'user2'
         10        OP_DATA                                                  !0
   29    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   30    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'unserialize'
         16        INIT_FCALL                                               'serialize'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $11     
         19        SEND_VAR                                                 $11
         20        DO_ICALL                                         $12     
         21        SEND_VAR                                                 $12
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class User: [no user functions]
Class UserCouple:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BXuv8
function name:  serialize
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'serialize'
          1        INIT_ARRAY                                       ~0      42
          2        INIT_FCALL                                               'serialize'
          3        FETCH_OBJ_R                                      ~1      'user1'
          4        INIT_ARRAY                                       ~2      ~1
          5        FETCH_OBJ_R                                      ~3      'user2'
          6        ADD_ARRAY_ELEMENT                                ~2      ~3
          7        SEND_VAL                                                 ~2
          8        DO_ICALL                                         $4      
          9        ADD_ARRAY_ELEMENT                                ~0      $4
         10        SEND_VAL                                                 ~0
         11        DO_ICALL                                         $5      
         12      > RETURN                                                   $5
   15    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/BXuv8
function name:  unserialize
number of ops:  20
compiled vars:  !0 = $serialized, !1 = $_, !2 = $subSerialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        FETCH_LIST_R                                     $4      $3, 0
          5        ASSIGN                                                   !1, $4
          6        FETCH_LIST_R                                     $6      $3, 1
          7        ASSIGN                                                   !2, $6
          8        FREE                                                     $3
   20     9        INIT_FCALL                                               'unserialize'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $8      
         12        FETCH_LIST_R                                     $9      $8, 0
         13        ASSIGN_OBJ                                               'user1'
         14        OP_DATA                                                  $9
         15        FETCH_LIST_R                                     $11     $8, 1
         16        ASSIGN_OBJ                                               'user2'
         17        OP_DATA                                                  $11
         18        FREE                                                     $8
   21    19      > RETURN                                                   null

End of function unserialize

End of class UserCouple.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.15 ms | 1400 KiB | 19 Q