3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE); class Definition implements Serializable { private $value; public function __construct($value) { $this->value = $value; } public function serialize() { echo serialize([$this->value])."\n"; return serialize($this->value); } public function unserialize($data) { $this->value = unserialize($data); } } $a=new stdClass(); $d=new Definition($a); var_dump(unserialize(serialize([$d,'This text will appear twice!',$a])));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9hVS2
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a, !1 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 7
          2        DO_ICALL                                                 
    3     3        DECLARE_CLASS                                            'definition'
   17     4        NEW                                              $3      'stdClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
   18     7        NEW                                              $6      'Definition'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $6
   19    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'unserialize'
         13        INIT_FCALL                                               'serialize'
         14        INIT_ARRAY                                       ~9      !1
         15        ADD_ARRAY_ELEMENT                                ~9      'This+text+will+appear+twice%21'
         16        ADD_ARRAY_ELEMENT                                ~9      !0
         17        SEND_VAL                                                 ~9
         18        DO_ICALL                                         $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                         $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

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

End of function unserialize

End of class Definition.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.42 ms | 1400 KiB | 21 Q