3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sHtml = '<p>the info that i really need is here<p> <p class="text-right"><a class="btn btn-default espbott aplus" role="button" href="brand/google.html">Google</a></p>'; $sHtml = '<div id="wrapper">' . $sHtml . '</div>'; echo "org:\n"; echo $sHtml; echo "\n\n"; $doc = new DOMDocument(); $doc->loadHtml($sHtml); foreach( $doc->getElementsByTagName( 'a' ) as $element ) { $element->parentNode->removeChild( $element ); } echo "res:\n"; echo $doc->saveHTML($doc->getElementById('wrapper')); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/RhuEU
function name:  (null)
number of ops:  33
compiled vars:  !0 = $sHtml, !1 = $doc, !2 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cp%3Ethe+info+that+i+really+need+is+here%3Cp%3E%0A+++++%3Cp+class%3D%22text-right%22%3E%3Ca+class%3D%22btn+btn-default+espbott+aplus%22+role%3D%22button%22%0A++++++href%3D%22brand%2Fgoogle.html%22%3EGoogle%3C%2Fa%3E%3C%2Fp%3E'
    6     1        CONCAT                                           ~4      '%3Cdiv+id%3D%22wrapper%22%3E', !0
          2        CONCAT                                           ~5      ~4, '%3C%2Fdiv%3E'
          3        ASSIGN                                                   !0, ~5
    7     4        ECHO                                                     'org%3A%0A'
    8     5        ECHO                                                     !0
   10     6        ECHO                                                     '%0A%0A'
   12     7        NEW                                              $7      'DOMDocument'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   13    10        INIT_METHOD_CALL                                         !1, 'loadHtml'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
   15    13        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         14        SEND_VAL_EX                                              'a'
         15        DO_FCALL                                      0  $11     
         16      > FE_RESET_R                                       $12     $11, ->23
         17    > > FE_FETCH_R                                               $12, !2, ->23
   16    18    >   FETCH_OBJ_R                                      ~13     !2, 'parentNode'
         19        INIT_METHOD_CALL                                         ~13, 'removeChild'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0          
   15    22      > JMP                                                      ->17
         23    >   FE_FREE                                                  $12
   19    24        ECHO                                                     'res%3A%0A'
   20    25        INIT_METHOD_CALL                                         !1, 'saveHTML'
         26        INIT_METHOD_CALL                                         !1, 'getElementById'
         27        SEND_VAL_EX                                              'wrapper'
         28        DO_FCALL                                      0  $15     
         29        SEND_VAR_NO_REF_EX                                       $15
         30        DO_FCALL                                      0  $16     
         31        ECHO                                                     $16
   21    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.97 ms | 1000 KiB | 13 Q