3v4l.org

run code in 300+ 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 = 30
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/0BO3l
function name:  (null)
number of ops:  35
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, ->30
         12    > > FE_FETCH_R                                               $10, !2, ->30
    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, ->29
   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        INIT_FCALL                                               'trim'
         24        FETCH_OBJ_R                                      ~17     !3, 'nodeValue'
         25        SEND_VAL                                                 ~17
         26        DO_ICALL                                         $18     
         27        ASSIGN_OBJ                                               !3, 'nodeValue'
         28        OP_DATA                                                  $18
    8    29    > > JMP                                                      ->12
         30    >   FE_FREE                                                  $10
   15    31        INIT_METHOD_CALL                                         !1, 'saveHTML'
         32        DO_FCALL                                      0  $19     
         33        ECHO                                                     $19
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.58 ms | 1001 KiB | 14 Q