3v4l.org

run code in 300+ PHP versions simultaneously
<?php function TextSimilar($frase1,$frase2){ /* incio da função *************** */ $explosao = explode(' ', $frase1); $palavras = count($explosao);//contar o numero de palavras $i = 0; $wtemp =''; $novos = null;//array para receber os novos valores for($i=0;$i<$palavras;$i++){ $wtemp = $explosao[$i] ; $temvirgula=false; $temp =$wtemp; if(strpos($temp,',')>0){//verificiar existencia de virgula $temvirgula=true; $temp = substr($wtemp,0,strlen($wtemp)-1);} /* comparar a palavra com o modelo */ similar_text(strtoupper($temp),strtoupper($frase2),$percento); //se existir similitude if($percento>=95){ $temp = '<span style="color:#ff0000;font-weight:bold;">' . $temp .'</span>';} //repor a palavra $wtemp=$temp; if($temvirgula==true){ $wtemp = $temp . ',';} $novos[] = $wtemp; } //fim do for $x = implode(' ',$novos);// repor a frase return $x; /* fim da função ************ */ } $frase1 = 'N ga be mu vêdê, madji n saí me ka pia bô - como'; $frase2 = 'vêdê'; $x = TextSimilar($frase1,$frase2); echo $x;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZZ4h
function name:  (null)
number of ops:  9
compiled vars:  !0 = $frase1, !1 = $frase2, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   ASSIGN                                                   !0, 'N+ga+be+mu+v%C3%AAd%C3%AA%2C+madji+n+sa%C3%AD+me+ka+pia+b%C3%B4+-+como'
   37     1        ASSIGN                                                   !1, 'v%C3%AAd%C3%AA'
   38     2        INIT_FCALL                                               'textsimilar'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !2, $5
   39     7        ECHO                                                     !2
          8      > RETURN                                                   1

Function textsimilar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 14
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 33
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 49
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 54
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 14
Branch analysis from position: 59
Branch analysis from position: 14
Branch analysis from position: 54
Branch analysis from position: 49
Branch analysis from position: 33
filename:       /in/EZZ4h
function name:  TextSimilar
number of ops:  66
compiled vars:  !0 = $frase1, !1 = $frase2, !2 = $explosao, !3 = $palavras, !4 = $i, !5 = $wtemp, !6 = $novos, !7 = $temvirgula, !8 = $temp, !9 = $percento, !10 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $11     
          6        ASSIGN                                                   !2, $11
    6     7        COUNT                                            ~13     !2
          8        ASSIGN                                                   !3, ~13
    7     9        ASSIGN                                                   !4, 0
    8    10        ASSIGN                                                   !5, ''
    9    11        ASSIGN                                                   !6, null
   11    12        ASSIGN                                                   !4, 0
         13      > JMP                                                      ->57
   12    14    >   FETCH_DIM_R                                      ~19     !2, !4
         15        ASSIGN                                                   !5, ~19
   13    16        ASSIGN                                                   !7, <false>
   14    17        ASSIGN                                                   !8, !5
   16    18        INIT_FCALL                                               'strpos'
         19        SEND_VAR                                                 !8
         20        SEND_VAL                                                 '%2C'
         21        DO_ICALL                                         $23     
         22        IS_SMALLER                                               0, $23
         23      > JMPZ                                                     ~24, ->33
   17    24    >   ASSIGN                                                   !7, <true>
   18    25        INIT_FCALL                                               'substr'
         26        SEND_VAR                                                 !5
         27        SEND_VAL                                                 0
         28        STRLEN                                           ~26     !5
         29        SUB                                              ~27     ~26, 1
         30        SEND_VAL                                                 ~27
         31        DO_ICALL                                         $28     
         32        ASSIGN                                                   !8, $28
   20    33    >   INIT_FCALL                                               'similar_text'
         34        INIT_FCALL                                               'strtoupper'
         35        SEND_VAR                                                 !8
         36        DO_ICALL                                         $30     
         37        SEND_VAR                                                 $30
         38        INIT_FCALL                                               'strtoupper'
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                         $31     
         41        SEND_VAR                                                 $31
         42        SEND_REF                                                 !9
         43        DO_ICALL                                                 
   22    44        IS_SMALLER_OR_EQUAL                                      95, !9
         45      > JMPZ                                                     ~33, ->49
   23    46    >   CONCAT                                           ~34     '%3Cspan+style%3D%22color%3A%23ff0000%3Bfont-weight%3Abold%3B%22%3E', !8
         47        CONCAT                                           ~35     ~34, '%3C%2Fspan%3E'
         48        ASSIGN                                                   !8, ~35
   25    49    >   ASSIGN                                                   !5, !8
   26    50        BOOL                                             ~38     !7
         51      > JMPZ                                                     ~38, ->54
   27    52    >   CONCAT                                           ~39     !8, '%2C'
         53        ASSIGN                                                   !5, ~39
   28    54    >   ASSIGN_DIM                                               !6
         55        OP_DATA                                                  !5
   11    56        PRE_INC                                                  !4
         57    >   IS_SMALLER                                               !4, !3
         58      > JMPNZ                                                    ~43, ->14
   31    59    >   INIT_FCALL                                               'implode'
         60        SEND_VAL                                                 '+'
         61        SEND_VAR                                                 !6
         62        DO_ICALL                                         $44     
         63        ASSIGN                                                   !10, $44
   32    64      > RETURN                                                   !10
   34    65*     > RETURN                                                   null

End of function textsimilar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.98 ms | 1403 KiB | 26 Q