3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strip_a_tags_and_contents($in) { $dom = new DOMDocument(); $dom->loadHTML($in); $dom->preserveWhiteSpace = false; $elements = $dom->getElementsByTagName('a'); while($span = $elements->item(0)) { $span->parentNode->removeChild($span); } return $dom->saveHTML(); } echo strip_a_tags_and_contents('Mike Schindle discusses the risks management of manufacturing supply chains <a href="/expo-details/schedule/#risk-mgmt" target="_blank">More info &raquo;</a>');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rSNI9
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'strip_a_tags_and_contents'
          1        SEND_VAL                                                 'Mike+Schindle+discusses+the+risks+management+of+manufacturing+supply+chains+%3Ca+href%3D%22%2Fexpo-details%2Fschedule%2F%23risk-mgmt%22+target%3D%22_blank%22%3EMore+info+%26raquo%3B%3C%2Fa%3E'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function strip_a_tags_and_contents:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 14
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 14
Branch analysis from position: 23
Branch analysis from position: 14
filename:       /in/rSNI9
function name:  strip_a_tags_and_contents
number of ops:  27
compiled vars:  !0 = $in, !1 = $dom, !2 = $elements, !3 = $span
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        NEW                                              $4      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
    4     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    5     7        ASSIGN_OBJ                                               !1, 'preserveWhiteSpace'
          8        OP_DATA                                                  <false>
    7     9        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         10        SEND_VAL_EX                                              'a'
         11        DO_FCALL                                      0  $9      
         12        ASSIGN                                                   !2, $9
    8    13      > JMP                                                      ->18
    9    14    >   FETCH_OBJ_R                                      ~11     !3, 'parentNode'
         15        INIT_METHOD_CALL                                         ~11, 'removeChild'
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0          
    8    18    >   INIT_METHOD_CALL                                         !2, 'item'
         19        SEND_VAL_EX                                              0
         20        DO_FCALL                                      0  $13     
         21        ASSIGN                                           ~14     !3, $13
         22      > JMPNZ                                                    ~14, ->14
   12    23    >   INIT_METHOD_CALL                                         !1, 'saveHTML'
         24        DO_FCALL                                      0  $15     
         25      > RETURN                                                   $15
   13    26*     > RETURN                                                   null

End of function strip_a_tags_and_contents

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.06 ms | 1399 KiB | 14 Q