3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML 税务调查。 [caption id="attachment_111" align="aligncenter" width="100"]<img src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="拜登与儿子。" width="100" height="100" class="size-full wp-image" /> 拜登与儿子。[/caption] 他在声明中说:“我会非常认真地调查,往来。” <img src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="拜登总统" width="100" height="100" class="aligncenter size-full wp-image" /> <div style="position:relative; overflow:hidden"> <iframe src="https://cdn.google.com/players/VM.html" width="100" height="100" frameborder="0" scrolling="auto" title="大促销 拜登的美国" style="position:absolute;"></iframe> </div> <iframe style="border: none; overflow: hidden;" src="https://www.facebook.com/plugins/video.php?height=100&amp;href=https%3A%2F%2Fwww.facebook.com;width=100&amp;t=0" width="100" height="100" frameborder="0" allowfullscreen="allowfullscreen"></iframe> <iframe src="https://www.facebook.com/plugins/video.php?height=400&href=https%3A%2F%2&show_text=false&width=100&t=0" width="100" height="100" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" allowFullScreen="true"></iframe> <b>更多热点</b> <p>halo拜登也指美国经济不会衰退</p> <figure id="attachment_279" style="width: 100px" class="wp-caption alignnone"><img class="size-full wp-imag" src="https://royaldesign.com/image/11/gubi-moon-dining-table-round-120-h73-3?w=168&quality=80" alt="修理厂商总会拜登城" width="100" height="100" /><figcaption class="wp-caption-text">修理厂商总会拜登城</figcaption></figure> <a href="http://google.com">go to google</a> <span style="color: #ff6600;"><strong>另外,拜登声明中说</strong></span> HTML; $tags = ["拜登", "认真"]; $blacklisted = implode( '|', array_map( fn($tag) => "<{$tag}[ >].+?" . ($tag === 'img' ? "/>" : "</$tag>"), ['a', 'img', 'iframe', 'figure', 'figcaption'] ) ); echo preg_replace( sprintf('~(?:\[caption[ \]].+?\[/caption]|%s)(*SKIP)(*FAIL)|%s~us', $blacklisted, implode('|', $tags)), '<span class="article-tag"><a class="mytag" href="http://outside.com">$0</a></span>', $html );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KgAYA
function name:  (null)
number of ops:  28
compiled vars:  !0 = $html, !1 = $tags, !2 = $blacklisted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%E7%A8%8E%E5%8A%A1%E8%B0%83%E6%9F%A5%E3%80%82%0A%0A%5Bcaption+id%3D%22attachment_111%22+align%3D%22aligncenter%22+width%3D%22100%22%5D%3Cimg+src%3D%22https%3A%2F%2Froyaldesign.com%2Fimage%2F11%2Fgubi-moon-dining-table-round-120-h73-3%3Fw%3D168%26quality%3D80%22+alt%3D%22%E6%8B%9C%E7%99%BB%E4%B8%8E%E5%84%BF%E5%AD%90%E3%80%82%22+width%3D%22100%22+height%3D%22100%22+class%3D%22size-full+wp-image%22+%2F%3E+%E6%8B%9C%E7%99%BB%E4%B8%8E%E5%84%BF%E5%AD%90%E3%80%82%5B%2Fcaption%5D%0A%0A%E4%BB%96%E5%9C%A8%E5%A3%B0%E6%98%8E%E4%B8%AD%E8%AF%B4%EF%BC%9A%E2%80%9C%E6%88%91%E4%BC%9A%E9%9D%9E%E5%B8%B8%E8%AE%A4%E7%9C%9F%E5%9C%B0%E8%B0%83%E6%9F%A5%EF%BC%8C%E5%BE%80%E6%9D%A5%E3%80%82%E2%80%9D%0A%0A%3Cimg+src%3D%22https%3A%2F%2Froyaldesign.com%2Fimage%2F11%2Fgubi-moon-dining-table-round-120-h73-3%3Fw%3D168%26quality%3D80%22+alt%3D%22%E6%8B%9C%E7%99%BB%E6%80%BB%E7%BB%9F%22+width%3D%22100%22+height%3D%22100%22+class%3D%22aligncenter+size-full+wp-image%22+%2F%3E%0A%0A%3Cdiv+style%3D%22position%3Arelative%3B+overflow%3Ahidden%22%3E+%3Ciframe+src%3D%22https%3A%2F%2Fcdn.google.com%2Fplayers%2FVM.html%22+width%3D%22100%22+height%3D%22100%22+frameborder%3D%220%22+scrolling%3D%22auto%22+title%3D%22%E5%A4%A7%E4%BF%83%E9%94%80+%E6%8B%9C%E7%99%BB%E7%9A%84%E7%BE%8E%E5%9B%BD%22+style%3D%22position%3Aabsolute%3B%22%3E%3C%2Fiframe%3E+%3C%2Fdiv%3E%0A%0A%3Ciframe+style%3D%22border%3A+none%3B+overflow%3A+hidden%3B%22+src%3D%22https%3A%2F%2Fwww.facebook.com%2Fplugins%2Fvideo.php%3Fheight%3D100%26amp%3Bhref%3Dhttps%253A%252F%252Fwww.facebook.com%3Bwidth%3D100%26amp%3Bt%3D0%22+width%3D%22100%22+height%3D%22100%22+frameborder%3D%220%22+allowfullscreen%3D%22allowfullscreen%22%3E%3C%2Fiframe%3E%0A%0A%3Ciframe+src%3D%22https%3A%2F%2Fwww.facebook.com%2Fplugins%2Fvideo.php%3Fheight%3D400%26href%3Dhttps%253A%252F%252%26show_text%3Dfalse%26width%3D100%26t%3D0%22+width%3D%22100%22+height%3D%22100%22+style%3D%22border%3Anone%3Boverflow%3Ahidden%22+scrolling%3D%22no%22+frameborder%3D%220%22+allowfullscreen%3D%22true%22+allow%3D%22autoplay%3B+clipboard-write%3B+encrypted-media%3B+picture-in-picture%3B+web-share%22+allowFullScreen%3D%22true%22%3E%3C%2Fiframe%3E%0A%0A%3Cb%3E%E6%9B%B4%E5%A4%9A%E7%83%AD%E7%82%B9%3C%2Fb%3E%0A%0A%3Cp%3Ehalo%E6%8B%9C%E7%99%BB%E4%B9%9F%E6%8C%87%E7%BE%8E%E5%9B%BD%E7%BB%8F%E6%B5%8E%E4%B8%8D%E4%BC%9A%E8%A1%B0%E9%80%80%3C%2Fp%3E%0A%0A%3Cfigure+id%3D%22attachment_279%22+style%3D%22width%3A+100px%22+class%3D%22wp-caption+alignnone%22%3E%3Cimg+class%3D%22size-full+wp-imag%22+src%3D%22https%3A%2F%2Froyaldesign.com%2Fimage%2F11%2Fgubi-moon-dining-table-round-120-h73-3%3Fw%3D168%26quality%3D80%22+alt%3D%22%E4%BF%AE%E7%90%86%E5%8E%82%E5%95%86%E6%80%BB%E4%BC%9A%E6%8B%9C%E7%99%BB%E5%9F%8E%22+width%3D%22100%22+height%3D%22100%22+%2F%3E%3Cfigcaption+class%3D%22wp-caption-text%22%3E%E4%BF%AE%E7%90%86%E5%8E%82%E5%95%86%E6%80%BB%E4%BC%9A%E6%8B%9C%E7%99%BB%E5%9F%8E%3C%2Ffigcaption%3E%3C%2Ffigure%3E%0A%0A%3Ca+href%3D%22http%3A%2F%2Fgoogle.com%22%3Ego+to+google%3C%2Fa%3E%0A%0A%3Cspan+style%3D%22color%3A+%23ff6600%3B%22%3E%3Cstrong%3E%E5%8F%A6%E5%A4%96%EF%BC%8C%E6%8B%9C%E7%99%BB%E5%A3%B0%E6%98%8E%E4%B8%AD%E8%AF%B4%3C%2Fstrong%3E%3C%2Fspan%3E'
   29     1        ASSIGN                                                   !1, <array>
   30     2        INIT_FCALL                                               'implode'
   31     3        SEND_VAL                                                 '%7C'
   32     4        INIT_FCALL                                               'array_map'
   33     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKgAYA%3A33%240'
          6        SEND_VAL                                                 ~5
   34     7        SEND_VAL                                                 <array>
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
   30    11        ASSIGN                                                   !2, $7
   37    12        INIT_FCALL                                               'preg_replace'
   38    13        INIT_FCALL                                               'sprintf'
         14        SEND_VAL                                                 '%7E%28%3F%3A%5C%5Bcaption%5B+%5C%5D%5D.%2B%3F%5C%5B%2Fcaption%5D%7C%25s%29%28%2ASKIP%29%28%2AFAIL%29%7C%25s%7Eus'
         15        SEND_VAR                                                 !2
         16        INIT_FCALL                                               'implode'
         17        SEND_VAL                                                 '%7C'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                         $10     
         22        SEND_VAR                                                 $10
   39    23        SEND_VAL                                                 '%3Cspan+class%3D%22article-tag%22%3E%3Ca+class%3D%22mytag%22+href%3D%22http%3A%2F%2Foutside.com%22%3E%240%3C%2Fa%3E%3C%2Fspan%3E'
   40    24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $11     
         26        ECHO                                                     $11
   41    27      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKgAYA%3A33%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KgAYA
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $tag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
          1        ROPE_INIT                                     3  ~2      '%3C'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%5B+%3E%5D.%2B%3F'
          4        IS_IDENTICAL                                             !0, 'img'
          5      > JMPZ                                                     ~4, ->8
          6    >   QM_ASSIGN                                        ~5      '%2F%3E'
          7      > JMP                                                      ->12
          8    >   ROPE_INIT                                     3  ~7      '%3C%2F'
          9        ROPE_ADD                                      1  ~7      ~7, !0
         10        ROPE_END                                      2  ~6      ~7, '%3E'
         11        QM_ASSIGN                                        ~5      ~6
         12    >   CONCAT                                           ~9      ~1, ~5
         13      > RETURN                                                   ~9
         14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKgAYA%3A33%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.14 ms | 1405 KiB | 21 Q