3v4l.org

run code in 300+ PHP versions simultaneously
<?php function special_text( $content ) { $search_for = 'specialtext'; $replace_with = '<span class="special-text"><strong>special</strong>text</span>'; return preg_replace( '/<a.*?<\/a>(*SKIP)(*F)|'.$search_for.'/m', $replace_with, $content ); } echo "<pre>" . special_text('<a title="specialtext" href="http://specialtext.com">specialtext</a>') . "</pre>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NKoQJ
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'special_text'
          1        SEND_VAL                                                 '%3Ca+title%3D%22specialtext%22+href%3D%22http%3A%2F%2Fspecialtext.com%22%3Especialtext%3C%2Fa%3E'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      '%3Cpre%3E', $0
          4        CONCAT                                           ~2      ~1, '%3C%2Fpre%3E'
          5        ECHO                                                     ~2
          6      > RETURN                                                   1

Function special_text:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NKoQJ
function name:  special_text
number of ops:  12
compiled vars:  !0 = $content, !1 = $search_for, !2 = $replace_with
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 'specialtext'
    5     2        ASSIGN                                                   !2, '%3Cspan+class%3D%22special-text%22%3E%3Cstrong%3Especial%3C%2Fstrong%3Etext%3C%2Fspan%3E'
    6     3        INIT_FCALL                                               'preg_replace'
          4        CONCAT                                           ~5      '%2F%3Ca.%2A%3F%3C%5C%2Fa%3E%28%2ASKIP%29%28%2AF%29%7C', !1
          5        CONCAT                                           ~6      ~5, '%2Fm'
          6        SEND_VAL                                                 ~6
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10      > RETURN                                                   $7
    7    11*     > RETURN                                                   null

End of function special_text

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.13 ms | 1398 KiB | 16 Q