3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = <<<HTML This is a test buton. <span id="UmniBooking_36" class="insideB" type="Form" style="cursor: pointer;color:" role="button" >Click here</span> HTML; $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); foreach ($dom->getElementsByTagName('span') as $span) { if ($span->getAttribute('role') === 'button') { $parent = $span->parentNode; $parent->removeChild($span); $parent->nodeValue = trim($parent->nodeValue); } } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 28
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 27
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/0BO3l
function name:  (null)
number of ops:  33
compiled vars:  !0 = $html, !1 = $dom, !2 = $span, !3 = $parent
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 'This+is+a+test+buton.+%3Cspan+id%3D%22UmniBooking_36%22+class%3D%22insideB%22+type%3D%22Form%22+style%3D%22cursor%3A+pointer%3Bcolor%3A%22+role%3D%22button%22+%3EClick+here%3C%2Fspan%3E'
    6     1        NEW                                                  $5      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $5
    7     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        SEND_VAL_EX                                                  8196
          7        DO_FCALL                                          0          
    8     8        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
          9        SEND_VAL_EX                                                  'span'
         10        DO_FCALL                                          0  $9      
         11      > FE_RESET_R                                           $10     $9, ->28
         12    > > FE_FETCH_R                                                   $10, !2, ->28
    9    13    >   INIT_METHOD_CALL                                             !2, 'getAttribute'
         14        SEND_VAL_EX                                                  'role'
         15        DO_FCALL                                          0  $11     
         16        IS_IDENTICAL                                                 $11, 'button'
         17      > JMPZ                                                         ~12, ->27
   10    18    >   FETCH_OBJ_R                                          ~13     !2, 'parentNode'
         19        ASSIGN                                                       !3, ~13
   11    20        INIT_METHOD_CALL                                             !3, 'removeChild'
         21        SEND_VAR_EX                                                  !2
         22        DO_FCALL                                          0          
   12    23        FETCH_OBJ_R                                          ~17     !3, 'nodeValue'
         24        FRAMELESS_ICALL_1                trim                ~18     ~17
         25        ASSIGN_OBJ                                                   !3, 'nodeValue'
         26        OP_DATA                                                      ~18
    8    27    > > JMP                                                          ->12
         28    >   FE_FREE                                                      $10
   15    29        INIT_METHOD_CALL                                             !1, 'saveHTML'
         30        DO_FCALL                                          0  $19     
         31        ECHO                                                         $19
         32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
189.06 ms | 1584 KiB | 13 Q