3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrErros = array('teste de log 1','log vermelho com preto','log amarelo e roxo','quatro paredes em azul','azul eh a cor do oceano','no ocenano tem peixes marinhos','vermelho nao combina com azul','teste de log 1A'); //THRESHOLD PARA CÁLCULO DE SIMILARIDADE $threshold = 60; //INDEXAR VETOR DE PESQUISA $matriz_indexada = array(); $matriz_resultado = array(); foreach ($arrErros as $chave => $valor){ $matriz_indexada[$chave]['valor'] = $valor; $matriz_indexada[$chave]['chave'] = $chave; $matriz_indexada[$chave]['used'] = 0; } //CONSTRUIR VETOR DE SIMILARIDADE $totallinha = count($matriz_indexada); for ($i=0; $i<$totallinha-1; $i++){ $matriz_resultado[$i]['mensagem'] = $matriz_indexada[$i]['valor']; $matriz_resultado[$i]['count'] = 1; if ($matriz_indexada[$i]['used'] != 1){ for ($j=$i+1; $j<$totallinha; $j++){ similar_text($matriz_indexada[$i]['valor'], $matriz_indexada[$j]['valor'], $percent); if (($percent >= $threshold)){ $matriz_indexada[$j]['used'] = 1; $matriz_resultado[$i]['mensagem'] = $matriz_resultado[$i]['mensagem']; $matriz_resultado[$i]['count']++; } } } } /* //ORDENAR VETOR COM BUBBLE SORT $totallinha = count($matriz_resultado); for ($i=0; $i<$totallinha-1; $i++){ for ($j=0; $j<$totallinha-1; $j++){ if ($matriz_resultado[$i]['count'] > $matriz_resultado[$j]['count']){ $mensagem = $matriz_resultado[$i]['mensagem']; $count = $matriz_resultado[$i]['count']; $matriz_resultado[$i]['mensagem'] = $matriz_resultado[$j]['mensagem']; $matriz_resultado[$i]['count'] = $matriz_resultado[$j]['count']; $matriz_resultado[$j]['mensagem'] = $mensagem; $matriz_resultado[$j]['count'] = $count; } } } */ print_r($matriz_resultado);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 22
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 62
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 37
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 22
Branch analysis from position: 66
Branch analysis from position: 22
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 59
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 37
Branch analysis from position: 62
Branch analysis from position: 37
Branch analysis from position: 59
Branch analysis from position: 62
Branch analysis from position: 17
filename:       /in/47kBY
function name:  (null)
number of ops:  70
compiled vars:  !0 = $arrErros, !1 = $threshold, !2 = $matriz_indexada, !3 = $matriz_resultado, !4 = $valor, !5 = $chave, !6 = $totallinha, !7 = $i, !8 = $j, !9 = $percent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 60
    9     2        ASSIGN                                                   !2, <array>
   10     3        ASSIGN                                                   !3, <array>
   11     4      > FE_RESET_R                                       $14     !0, ->17
          5    > > FE_FETCH_R                                       ~15     $14, !4, ->17
          6    >   ASSIGN                                                   !5, ~15
   12     7        FETCH_DIM_W                                      $17     !2, !5
          8        ASSIGN_DIM                                               $17, 'valor'
          9        OP_DATA                                                  !4
   13    10        FETCH_DIM_W                                      $19     !2, !5
         11        ASSIGN_DIM                                               $19, 'chave'
         12        OP_DATA                                                  !5
   14    13        FETCH_DIM_W                                      $21     !2, !5
         14        ASSIGN_DIM                                               $21, 'used'
         15        OP_DATA                                                  0
   11    16      > JMP                                                      ->5
         17    >   FE_FREE                                                  $14
   18    18        COUNT                                            ~23     !2
         19        ASSIGN                                                   !6, ~23
   19    20        ASSIGN                                                   !7, 0
         21      > JMP                                                      ->63
   20    22    >   FETCH_DIM_R                                      ~28     !2, !7
         23        FETCH_DIM_R                                      ~29     ~28, 'valor'
         24        FETCH_DIM_W                                      $26     !3, !7
         25        ASSIGN_DIM                                               $26, 'mensagem'
         26        OP_DATA                                                  ~29
   21    27        FETCH_DIM_W                                      $30     !3, !7
         28        ASSIGN_DIM                                               $30, 'count'
         29        OP_DATA                                                  1
   22    30        FETCH_DIM_R                                      ~32     !2, !7
         31        FETCH_DIM_R                                      ~33     ~32, 'used'
         32        IS_NOT_EQUAL                                             ~33, 1
         33      > JMPZ                                                     ~34, ->62
   23    34    >   ADD                                              ~35     !7, 1
         35        ASSIGN                                                   !8, ~35
         36      > JMP                                                      ->60
   24    37    >   INIT_FCALL                                               'similar_text'
         38        FETCH_DIM_R                                      ~37     !2, !7
         39        FETCH_DIM_R                                      ~38     ~37, 'valor'
         40        SEND_VAL                                                 ~38
         41        FETCH_DIM_R                                      ~39     !2, !8
         42        FETCH_DIM_R                                      ~40     ~39, 'valor'
         43        SEND_VAL                                                 ~40
         44        SEND_REF                                                 !9
         45        DO_ICALL                                                 
   25    46        IS_SMALLER_OR_EQUAL                                      !1, !9
         47      > JMPZ                                                     ~42, ->59
   26    48    >   FETCH_DIM_W                                      $43     !2, !8
         49        ASSIGN_DIM                                               $43, 'used'
         50        OP_DATA                                                  1
   27    51        FETCH_DIM_R                                      ~47     !3, !7
         52        FETCH_DIM_R                                      ~48     ~47, 'mensagem'
         53        FETCH_DIM_W                                      $45     !3, !7
         54        ASSIGN_DIM                                               $45, 'mensagem'
         55        OP_DATA                                                  ~48
   28    56        FETCH_DIM_RW                                     $49     !3, !7
         57        FETCH_DIM_RW                                     $50     $49, 'count'
         58        PRE_INC                                                  $50
   23    59    >   PRE_INC                                                  !8
         60    >   IS_SMALLER                                               !8, !6
         61      > JMPNZ                                                    ~53, ->37
   19    62    >   PRE_INC                                                  !7
         63    >   SUB                                              ~55     !6, 1
         64        IS_SMALLER                                               !7, ~55
         65      > JMPNZ                                                    ~56, ->22
   53    66    >   INIT_FCALL                                               'print_r'
         67        SEND_VAR                                                 !3
         68        DO_ICALL                                                 
         69      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.71 ms | 945 KiB | 18 Q