3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subj = "hello world"; $subj = explode(" ", "hello world"); $str = ["hallo", "helo","aaahelojjjj", "pizza", "Manhattan"]; $minStr = ""; $minDis = PHP_INT_MAX; foreach ($str as $curStr) { Foreach($subj as $word){ $dis = levenshtein($word, $curStr); $dist[$word][$dis][] = $curStr; } } Var_export($dist);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 25
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 25
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 23
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/OVp7J
function name:  (null)
number of ops:  30
compiled vars:  !0 = $subj, !1 = $str, !2 = $minStr, !3 = $minDis, !4 = $curStr, !5 = $word, !6 = $dis, !7 = $dist
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'hello+world'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAL                                                 'hello+world'
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !0, $9
    6     6        ASSIGN                                                   !1, <array>
    8     7        ASSIGN                                                   !2, ''
    9     8        ASSIGN                                                   !3, 9223372036854775807
   10     9      > FE_RESET_R                                       $14     !1, ->25
         10    > > FE_FETCH_R                                               $14, !4, ->25
   11    11    > > FE_RESET_R                                       $15     !0, ->23
         12    > > FE_FETCH_R                                               $15, !5, ->23
   12    13    >   INIT_FCALL                                               'levenshtein'
         14        SEND_VAR                                                 !5
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                         $16     
         17        ASSIGN                                                   !6, $16
   13    18        FETCH_DIM_W                                      $18     !7, !5
         19        FETCH_DIM_W                                      $19     $18, !6
         20        ASSIGN_DIM                                               $19
         21        OP_DATA                                                  !4
   11    22      > JMP                                                      ->12
         23    >   FE_FREE                                                  $15
   10    24      > JMP                                                      ->10
         25    >   FE_FREE                                                  $14
   16    26        INIT_FCALL                                               'var_export'
         27        SEND_VAR                                                 !7
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.86 ms | 1013 KiB | 16 Q