3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$input = "I don't want this piece. This is the sentence I want. In don't want this piece either"; $input = "I don't want this piece! This is the <a href='https://example.com/my-sentence'>sentence</a> I want. In don't want this piece either"; $filter = "sentence"; $regex = '~\b(?:[^.?!]|https?://[^<>\s"\']++)*?'.preg_quote($filter, '~').'(?:[^.?!]|https?://[^<>\s"\']++)*~u'; if (preg_match_all($regex, $input, $match)){ print_r( array_map(function($x) {return strip_tags($x);}, $match[0]) ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/YIiKc
function name:  (null)
number of ops:  25
compiled vars:  !0 = $input, !1 = $filter, !2 = $regex, !3 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'I+don%27t+want+this+piece%21+This+is+the+%3Ca+href%3D%27https%3A%2F%2Fexample.com%2Fmy-sentence%27%3Esentence%3C%2Fa%3E+I+want.+In+don%27t+want+this+piece+either'
    5     1        ASSIGN                                                   !1, 'sentence'
    6     2        INIT_FCALL                                               'preg_quote'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%7E'
          5        DO_ICALL                                         $6      
          6        CONCAT                                           ~7      '%7E%5Cb%28%3F%3A%5B%5E.%3F%21%5D%7Chttps%3F%3A%2F%2F%5B%5E%3C%3E%5Cs%22%27%5D%2B%2B%29%2A%3F', $6
          7        CONCAT                                           ~8      ~7, '%28%3F%3A%5B%5E.%3F%21%5D%7Chttps%3F%3A%2F%2F%5B%5E%3C%3E%5Cs%22%27%5D%2B%2B%29%2A%7Eu'
          8        ASSIGN                                                   !2, ~8
    7     9        INIT_FCALL                                               'preg_match_all'
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !0
         12        SEND_REF                                                 !3
         13        DO_ICALL                                         $10     
         14      > JMPZ                                                     $10, ->24
    8    15    >   INIT_FCALL                                               'print_r'
         16        INIT_FCALL                                               'array_map'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYIiKc%3A8%240'
         18        SEND_VAL                                                 ~11
         19        FETCH_DIM_R                                      ~12     !3, 0
         20        SEND_VAL                                                 ~12
         21        DO_ICALL                                         $13     
         22        SEND_VAR                                                 $13
         23        DO_ICALL                                                 
    9    24    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FYIiKc%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YIiKc
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strip_tags'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYIiKc%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.91 ms | 1396 KiB | 23 Q