3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "<address2>Replace this value</address2>"; $domDocument = new DOMDocument(); $domDocument->loadXML($string); $address2Elements = $domDocument->getElementsByTagName('address2'); foreach ($address2Elements as $address2) { $address2->nodeValue = "Value Replaced"; } var_dump($domDocument->saveXML());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/h22b4
function name:  (null)
number of ops:  23
compiled vars:  !0 = $string, !1 = $domDocument, !2 = $address2Elements, !3 = $address2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Caddress2%3EReplace+this+value%3C%2Faddress2%3E'
    4     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
    5     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    6     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'address2'
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !2, $9
    7    11      > FE_RESET_R                                       $11     !2, ->16
         12    > > FE_FETCH_R                                               $11, !3, ->16
    8    13    >   ASSIGN_OBJ                                               !3, 'nodeValue'
         14        OP_DATA                                                  'Value+Replaced'
    7    15      > JMP                                                      ->12
         16    >   FE_FREE                                                  $11
   12    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !1, 'saveXML'
         19        DO_FCALL                                      0  $13     
         20        SEND_VAR                                                 $13
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.17 ms | 1002 KiB | 14 Q