3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo extends DOMElement implements Serializable { public function serialize() {return 'foo';} public function unserialize($serialized) {$this->__construct('span','test');} } $Document = new DOMDocument('1.0'); $Document->registerNodeClass('DOMElement', 'foo'); $Document->loadHTML('<span>test</span>'); $Element = $Document->lastChild->firstChild; var_dump($Element);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EWh3u
function name:  (null)
number of ops:  19
compiled vars:  !0 = $Document, !1 = $Element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo', 'domelement'
    9     1        NEW                                              $2      'DOMDocument'
          2        SEND_VAL_EX                                              '1.0'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   10     5        INIT_METHOD_CALL                                         !0, 'registerNodeClass'
          6        SEND_VAL_EX                                              'DOMElement'
          7        SEND_VAL_EX                                              'foo'
          8        DO_FCALL                                      0          
   11     9        INIT_METHOD_CALL                                         !0, 'loadHTML'
         10        SEND_VAL_EX                                              '%3Cspan%3Etest%3C%2Fspan%3E'
         11        DO_FCALL                                      0          
   13    12        FETCH_OBJ_R                                      ~7      !0, 'lastChild'
         13        FETCH_OBJ_R                                      ~8      ~7, 'firstChild'
         14        ASSIGN                                                   !1, ~8
   15    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class foo:
Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EWh3u
function name:  serialize
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'foo'
          1*     > 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/EWh3u
function name:  unserialize
number of ops:  6
compiled vars:  !0 = $serialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        INIT_METHOD_CALL                                         '__construct'
          2        SEND_VAL_EX                                              'span'
          3        SEND_VAL_EX                                              'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   null

End of function unserialize

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.69 ms | 1396 KiB | 15 Q