3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text= '<p>test paragraph.</p><a href="index.php">Click link</a><p>test paragraph.</p><a href="index.php">Click link</a><p>test paragraph.</p>'; $pos = strpos($text, "<a href"); // find first a href while($pos !== false){ // loop until there is no more a href $pos2 = strpos($text, "</a>", $pos)+4; // find the end tag of the a $text = substr($text, 0, $pos) . substr($text, $pos2); // remove the tag and link text $pos = strpos($text, "<a href"); // find the next. If none is found "false" is returned meaning while ends. } echo strip_tags($text); // strip away other tags.
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 7
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 7
Branch analysis from position: 32
Branch analysis from position: 7
filename:       /in/YtJic
function name:  (null)
number of ops:  37
compiled vars:  !0 = $text, !1 = $pos, !2 = $pos2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3Etest+paragraph.%3C%2Fp%3E%3Ca+href%3D%22index.php%22%3EClick+link%3C%2Fa%3E%3Cp%3Etest+paragraph.%3C%2Fp%3E%3Ca+href%3D%22index.php%22%3EClick+link%3C%2Fa%3E%3Cp%3Etest+paragraph.%3C%2Fp%3E'
    5     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3Ca+href'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    7     6      > JMP                                                      ->30
    8     7    >   INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '%3C%2Fa%3E'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $6      
         12        ADD                                              ~7      $6, 4
         13        ASSIGN                                                   !2, ~7
    9    14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 0
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $9      
         19        INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $10     
         23        CONCAT                                           ~11     $9, $10
         24        ASSIGN                                                   !0, ~11
   10    25        INIT_FCALL                                               'strpos'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 '%3Ca+href'
         28        DO_ICALL                                         $13     
         29        ASSIGN                                                   !1, $13
    7    30    >   TYPE_CHECK                                  1018          !1
         31      > JMPNZ                                                    ~15, ->7
   13    32    >   INIT_FCALL                                               'strip_tags'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $16     
         35        ECHO                                                     $16
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.28 ms | 1396 KiB | 19 Q