3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new DOMDocument; $a->loadXML( '<?xml version="1.0" ?><root><foo>a<bar id="b"></bar></foo></root>' ); $newelement = new DOMElement( 'baz', 'c' ); $a->firstChild->appendChild( $newelement ); $newelement->setAttribute( 'whynot', 'whatever' ); echo $a->saveXML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mjfqG
function name:  (null)
number of ops:  23
compiled vars:  !0 = $a, !1 = $newelement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    4     3        INIT_METHOD_CALL                                         !0, 'loadXML'
          4        SEND_VAL_EX                                              '%3C%3Fxml+version%3D%221.0%22+%3F%3E%3Croot%3E%3Cfoo%3Ea%3Cbar+id%3D%22b%22%3E%3C%2Fbar%3E%3C%2Ffoo%3E%3C%2Froot%3E'
          5        DO_FCALL                                      0          
    5     6        NEW                                              $6      'DOMElement'
          7        SEND_VAL_EX                                              'baz'
          8        SEND_VAL_EX                                              'c'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $6
    6    11        FETCH_OBJ_R                                      ~9      !0, 'firstChild'
         12        INIT_METHOD_CALL                                         ~9, 'appendChild'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0          
    7    15        INIT_METHOD_CALL                                         !1, 'setAttribute'
         16        SEND_VAL_EX                                              'whynot'
         17        SEND_VAL_EX                                              'whatever'
         18        DO_FCALL                                      0          
    9    19        INIT_METHOD_CALL                                         !0, 'saveXML'
         20        DO_FCALL                                      0  $12     
         21        ECHO                                                     $12
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.02 ms | 1394 KiB | 13 Q