3v4l.org

run code in 300+ 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:  12
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                                               'str_replace'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $4      
         10      > RETURN                                                   $4
   14    11*     > 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:  32
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                                               'preg_replace'
          4        SEND_VAL                                                 '%2F%5Cs%2B%2F'
          5        SEND_VAL                                                 '%7C'
          6        INIT_FCALL                                               'prepare'
          7        INIT_FCALL                                               'preg_quote'
          8        INIT_FCALL                                               'trim'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DO_FCALL                                      0  $6      
         15        SEND_VAR                                                 $6
         16        DO_ICALL                                         $7      
         17        CONCAT                                           ~8      '%2F', $7
         18        CONCAT                                           ~9      ~8, '%2Fu'
         19        ASSIGN                                                   !3, ~9
   20    20        INIT_FCALL                                               'preg_replace'
         21        SEND_VAR                                                 !3
         22        ROPE_INIT                                     5  ~12     '%3C'
         23        ROPE_ADD                                      1  ~12     ~12, !2
         24        ROPE_ADD                                      2  ~12     ~12, '%3E%240%3C%2F'
         25        ROPE_ADD                                      3  ~12     ~12, !2
         26        ROPE_END                                      4  ~11     ~12, '%3E'
         27        SEND_VAL                                                 ~11
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $15     
         30      > RETURN                                                   $15
   21    31*     > RETURN                                                   null

End of function highlight

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
261.99 ms | 1087 KiB | 20 Q