3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vocabolario = array("la", "mia", "una", "prova", "con", "del", "testo"); function textCheck($text, &$vocabolario) { return preg_replace_callback('#(?!<.*?)\w+(?![^<>]*?>)#', function ($word) use ($vocabolario) { $word = $word[0]; if (preg_grep( "/".preg_quote($word)."/i" , $vocabolario)) { return $word; } return '<u>'.$word.'</u>'; }, $text); } echo textCheck("La mia รจ UNA provaa con del testo: <a href='http://pippo.it'>html</a>.", $vocabolario);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OUF9U
function name:  (null)
number of ops:  7
compiled vars:  !0 = $vocabolario
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'textcheck'
          2        SEND_VAL                                                 'La+mia+%C3%A8+UNA+provaa+con+del+testo%3A+%3Ca+href%3D%27http%3A%2F%2Fpippo.it%27%3Ehtml%3C%2Fa%3E.'
          3        SEND_REF                                                 !0
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function textcheck:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OUF9U
function name:  textCheck
number of ops:  11
compiled vars:  !0 = $text, !1 = $vocabolario
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%23%28%3F%21%3C.%2A%3F%29%5Cw%2B%28%3F%21%5B%5E%3C%3E%5D%2A%3F%3E%29%23'
          4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          5        BIND_LEXICAL                                             ~2, !1
   14     6        SEND_VAL                                                 ~2
          7        SEND_VAR                                                 !0
    6     8        DO_ICALL                                         $3      
   14     9      > RETURN                                                   $3
   15    10*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OUF9U
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $word, !1 = $vocabolario
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    7     2        FETCH_DIM_R                                      ~2      !0, 0
          3        ASSIGN                                                   !0, ~2
    9     4        INIT_FCALL                                               'preg_grep'
          5        INIT_FCALL                                               'preg_quote'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        CONCAT                                           ~5      '%2F', $4
          9        CONCAT                                           ~6      ~5, '%2Fi'
         10        SEND_VAL                                                 ~6
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13      > JMPZ                                                     $7, ->15
   10    14    > > RETURN                                                   !0
   13    15    >   CONCAT                                           ~8      '%3Cu%3E', !0
         16        CONCAT                                           ~9      ~8, '%3C%2Fu%3E'
         17      > RETURN                                                   ~9
   14    18*     > RETURN                                                   null

End of Dynamic Function 0

End of function textcheck

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.64 ms | 1007 KiB | 17 Q