3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A implements Serializable { function __construct($o) { $this->o = $o; } function serialize() { return serialize([$this->o]); } function unserialize($s) { $this->o = unserialize($s)[0]; } } $o = new stdClass; $r = unserialize(serialize([new A($o), new A($o)])); var_dump($r[0]->o === $r[1]->o);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5YP8
function name:  (null)
number of ops:  28
compiled vars:  !0 = $o, !1 = $r
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'a'
   13     1        NEW                                                  $2      'stdClass'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   14     4        INIT_FCALL                                                   'unserialize'
          5        INIT_FCALL                                                   'serialize'
          6        NEW                                                  $5      'A'
          7        SEND_VAR_EX                                                  !0
          8        DO_FCALL                                          0          
          9        INIT_ARRAY                                           ~7      $5
         10        NEW                                                  $8      'A'
         11        SEND_VAR_EX                                                  !0
         12        DO_FCALL                                          0          
         13        ADD_ARRAY_ELEMENT                                    ~7      $8
         14        SEND_VAL                                                     ~7
         15        DO_ICALL                                             $10     
         16        SEND_VAR                                                     $10
         17        DO_ICALL                                             $11     
         18        ASSIGN                                                       !1, $11
   15    19        INIT_FCALL                                                   'var_dump'
         20        FETCH_DIM_R                                          ~13     !1, 0
         21        FETCH_OBJ_R                                          ~14     ~13, 'o'
         22        FETCH_DIM_R                                          ~15     !1, 1
         23        FETCH_OBJ_R                                          ~16     ~15, 'o'
         24        IS_IDENTICAL                                         ~17     ~14, ~16
         25        SEND_VAL                                                     ~17
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5YP8
function name:  __construct
number of ops:  4
compiled vars:  !0 = $o
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        ASSIGN_OBJ                                                   'o'
          2        OP_DATA                                                      !0
    5     3      > RETURN                                                       null

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5YP8
function name:  serialize
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                                   'serialize'
          1        FETCH_OBJ_R                                          ~0      'o'
          2        INIT_ARRAY                                           ~1      ~0
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                             $2      
          5      > RETURN                                                       $2
    8     6*     > 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/t5YP8
function name:  unserialize
number of ops:  8
compiled vars:  !0 = $s
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        INIT_FCALL                                                   'unserialize'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        FETCH_DIM_R                                          ~3      $2, 0
          5        ASSIGN_OBJ                                                   'o'
          6        OP_DATA                                                      ~3
   11     7      > RETURN                                                       null

End of function unserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.29 ms | 3172 KiB | 16 Q