3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SerializableDomDocument // extends DOMDocument { private $xmlData; /** * @return array */ public function __sleep() { //$this->xmlData = $this->saveXML(); $this->xmlData = []; return ['xmlData']; } public function __wakeup() { $this->xmlData = ['xmlData']; } } $dom = new SerializableDomDocument('1.0', 'UTF-8'); //$dom->loadXML('<tag>value</tag>'); $ser = serialize($dom); var_dump($ser); var_dump(unserialize($ser));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K91Vv
function name:  (null)
number of ops:  19
compiled vars:  !0 = $dom, !1 = $ser
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $2      'SerializableDomDocument'
          1        SEND_VAL_EX                                              '1.0'
          2        SEND_VAL_EX                                              'UTF-8'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   27     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
   28     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   29    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'unserialize'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class SerializableDomDocument:
Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K91Vv
function name:  __sleep
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN_OBJ                                               'xmlData'
          1        OP_DATA                                                  <array>
   14     2      > RETURN                                                   <array>
   15     3*     > RETURN                                                   null

End of function __sleep

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K91Vv
function name:  __wakeup
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN_OBJ                                               'xmlData'
          1        OP_DATA                                                  <array>
   20     2      > RETURN                                                   null

End of function __wakeup

End of class SerializableDomDocument.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.38 ms | 1013 KiB | 16 Q