3v4l.org

run code in 500+ PHP versions simultaneously
<?php $bbcodes = [ '[URL]www.no.http.example.com[/URL]', '[url]https://any.com/any[/url]', '[url="nourl"]nourl[/url]', '[URL="https://any.com/any?any=333"]text text[/URL]', '[url="http://www.emptyTEXT.com"][/url]', '[url]http://www.any.com/any?any=44#sss[/url]', '[url="https://conflictinglink"]http://differenturl[/url]' ]; foreach ($bbcodes as $bbcode) { echo preg_replace('~\[url(?|]((https?://[^[]+))|(?:="(https?://[^"]+)")](.+?))\[/url]~i', '<a href=\"$1\">$2</a>', $bbcode); echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/PSuJi
function name:  (null)
number of ops:  10
compiled vars:  !0 = $bbcodes, !1 = $bbcode
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   12     1      > FE_RESET_R                                           $3      !0, ->8
          2    > > FE_FETCH_R                                                   $3, !1, ->8
   13     3    >   FRAMELESS_ICALL_3                preg_replace        ~4      '%7E%5C%5Burl%28%3F%7C%5D%28%28https%3F%3A%2F%2F%5B%5E%5B%5D%2B%29%29%7C%28%3F%3A%3D%22%28https%3F%3A%2F%2F%5B%5E%22%5D%2B%29%22%29%5D%28.%2B%3F%29%29%5C%5B%2Furl%5D%7Ei', '%3Ca+href%3D%5C%22%241%5C%22%3E%242%3C%2Fa%3E'
          4        OP_DATA                                                      !1
          5        ECHO                                                         ~4
   14     6        ECHO                                                         '%0A---%0A'
   12     7      > JMP                                                          ->2
          8    >   FE_FREE                                                      $3
   15     9      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.97 ms | 2716 KiB | 13 Q