3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<STR This is <a href="http://foo.com">This is #foo</a>. Simple #html-stuff text <a href=\"http://foobar.com#baz\">#simple</a> <span class="simple">simple #simple text text</span> STR; echo preg_replace('/(?!<a[^<>]*>[^#]+)#(\b[-_\w]+\b)(?![^<]*<\/a>)/', '<a href="/tags/$1">#$1</a>', $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JqFop
function name:  (null)
number of ops:  8
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+is+%3Ca+href%3D%22http%3A%2F%2Ffoo.com%22%3EThis+is+%23foo%3C%2Fa%3E.%0ASimple+%23html-stuff+text+%3Ca+href%3D%5C%22http%3A%2F%2Ffoobar.com%23baz%5C%22%3E%23simple%3C%2Fa%3E%0A%3Cspan+class%3D%22simple%22%3Esimple+%23simple+text+text%3C%2Fspan%3E%0A'
   11     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%28%3F%21%3Ca%5B%5E%3C%3E%5D%2A%3E%5B%5E%23%5D%2B%29%23%28%5Cb%5B-_%5Cw%5D%2B%5Cb%29%28%3F%21%5B%5E%3C%5D%2A%3C%5C%2Fa%3E%29%2F'
          3        SEND_VAL                                                 '%3Ca+href%3D%22%2Ftags%2F%241%22%3E%23%241%3C%2Fa%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.61 ms | 1394 KiB | 15 Q