3v4l.org

run code in 500+ PHP versions simultaneously
<?php function prepare($pattern) { $replacements = [ 'a' => '[aáàäâ]', 'c' => '[cč]', 'e' => '[eéèëê]', 'i' => '[ií]', 'y' => '[yý]' ]; return str_replace(array_keys($replacements), $replacements, $pattern); } function highlight($search, $subject, $htmlTag = 'mark') { $pattern = '/' . preg_replace('/\s+/', '|', prepare(preg_quote(trim($search)))) . '/u'; return preg_replace($pattern, "<$htmlTag>$0</$htmlTag>", $subject); } echo highlight('prijimac HD815', 'Satelitný prijímač, Amiko HD8155');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUX9b
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                                   'highlight'
          1        SEND_VAL                                                     'prijimac+HD815'
          2        SEND_VAL                                                     'Satelitn%C3%BD+prij%C3%ADma%C4%8D%2C+Amiko+HD8155'
          3        DO_FCALL                                          0  $0      
          4        ECHO                                                         $0
          5      > RETURN                                                       1

Function prepare:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUX9b
function name:  prepare
number of ops:  9
compiled vars:  !0 = $pattern, !1 = $replacements
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1        ASSIGN                                                       !1, <array>
   13     2        INIT_FCALL                                                   'array_keys'
          3        SEND_VAR                                                     !1
          4        DO_ICALL                                             $3      
          5        FRAMELESS_ICALL_3                str_replace         ~4      $3, !1
          6        OP_DATA                                                      !0
          7      > RETURN                                                       ~4
   14     8*     > RETURN                                                       null

End of function prepare

Function highlight:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUX9b
function name:  highlight
number of ops:  24
compiled vars:  !0 = $search, !1 = $subject, !2 = $htmlTag, !3 = $pattern
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV_INIT                                            !2      'mark'
   18     3        INIT_FCALL                                                   'prepare'
          4        INIT_FCALL                                                   'preg_quote'
          5        FRAMELESS_ICALL_1                trim                ~4      !0
          6        SEND_VAL                                                     ~4
          7        DO_ICALL                                             $5      
          8        SEND_VAR                                                     $5
          9        DO_FCALL                                          0  $6      
         10        FRAMELESS_ICALL_3                preg_replace        ~7      '%2F%5Cs%2B%2F', '%7C'
         11        OP_DATA                                                      $6
         12        CONCAT                                               ~8      '%2F', ~7
         13        CONCAT                                               ~9      ~8, '%2Fu'
         14        ASSIGN                                                       !3, ~9
   20    15        ROPE_INIT                                         5  ~12     '%3C'
         16        ROPE_ADD                                          1  ~12     ~12, !2
         17        ROPE_ADD                                          2  ~12     ~12, '%3E%240%3C%2F'
         18        ROPE_ADD                                          3  ~12     ~12, !2
         19        ROPE_END                                          4  ~11     ~12, '%3E'
         20        FRAMELESS_ICALL_3                preg_replace        ~15     !3, ~11
         21        OP_DATA                                                      !1
         22      > RETURN                                                       ~15
   21    23*     > RETURN                                                       null

End of function highlight

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
179.24 ms | 2129 KiB | 17 Q