3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str="This is a test - That game is awesome (Cristiano Ronaldo is a great Soccer Player)"; //clean string: $str=preg_replace("/[^A-Za-z0-9 ]/", '', $str); //first explode it $e=explode(' ',$str); //loop to remove short words $out=array(); foreach ($e as $a){ if(strlen($a)>2){ $out[]=$a; } } print_r($out); $list = array( "This" => "9", "great" => "10", "God Father" => "11", "Tony Montana" => "12", "Ronaldo" => "13", "Al Pacino" => "14", "Humans" => "15", "Play" => "16" ); foreach ($out as $keyword) { foreach ($list as $word=>$num) { $sim_chars = similar_text($keyword, $word); if ($sim_chars/strlen($keyword) > .8 || $sim_chars/strlen($word) > .8) { $all_key_values[] = $num; $all_keys[] = $word; } elseif (stripos($keyword, $word) !== false || strpos($word, $keyword) !== false) { $sll_key_values[] = $num; $all_keys[] = $word; } } }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
Jump found. Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
Jump found. Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
Jump found. Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 20
Branch analysis from position: 21
Jump found. Position 1 = 27, Position 2 = 70
Branch analysis from position: 27
Jump found. Position 1 = 28, Position 2 = 70
Branch analysis from position: 28
Jump found. Position 1 = 29, Position 2 = 68
Branch analysis from position: 29
Jump found. Position 1 = 30, Position 2 = 68
Branch analysis from position: 30
Jump found. Position 1 = 40, Position 2 = 44
Branch analysis from position: 40
Jump found. Position 1 = 45, Position 2 = 50
Branch analysis from position: 45
Jump found. Position 1 = 67
Branch analysis from position: 67
Jump found. Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 50
Jump found. Position 1 = 56, Position 2 = 62
Branch analysis from position: 56
Jump found. Position 1 = 63, Position 2 = 67
Branch analysis from position: 63
Jump found. Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 67
Branch analysis from position: 62
Branch analysis from position: 44
Branch analysis from position: 68
Jump found. Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 68
Branch analysis from position: 70
Jump found. Position 1 = -2
Branch analysis from position: 70
Branch analysis from position: 21
filename:       /in/2d0Li
function name:  (null)
number of ops:  72
compiled vars:  !0 = $str, !1 = $e, !2 = $out, !3 = $a, !4 = $list, !5 = $keyword, !6 = $num, !7 = $word, !8 = $sim_chars, !9 = $all_key_values, !10 = $all_keys, !11 = $sll_key_values
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, 'This+is+a+test+-+That+game+is+awesome+%28Cristiano+Ronaldo+is+a+great+Soccer+Player%29'
   7     1        INIT_FCALL                                               'preg_replace'
         2        SEND_VAL                                                 '%2F%5B%5EA-Za-z0-9+%5D%2F'
         3        SEND_VAL                                                 ''
         4        SEND_VAR                                                 !0
         5        DO_ICALL                                         $13     
         6        ASSIGN                                                   !0, $13
  10     7        INIT_FCALL                                               'explode'
         8        SEND_VAL                                                 '+'
         9        SEND_VAR                                                 !0
        10        DO_ICALL                                         $15     
        11        ASSIGN                                                   !1, $15
  13    12        ASSIGN                                                   !2, <array>
  14    13      > FE_RESET_R                                       $18     !1, ->21
        14    > > FE_FETCH_R                                               $18, !3, ->21
  16    15    >   STRLEN                                           ~19     !3
        16        IS_SMALLER                                       ~20     2, ~19
        17      > JMPZ                                                     ~20, ->20
  17    18    >   ASSIGN_DIM                                               !2
        19        OP_DATA                                                  !3
        20    > > JMP                                                      ->14
        21    >   FE_FREE                                                  $18
  21    22        INIT_FCALL                                               'print_r'
        23        SEND_VAR                                                 !2
        24        DO_ICALL                                                 
  24    25        ASSIGN                                                   !4, <array>
  35    26      > FE_RESET_R                                       $24     !2, ->70
        27    > > FE_FETCH_R                                               $24, !5, ->70
  36    28    > > FE_RESET_R                                       $25     !4, ->68
        29    > > FE_FETCH_R                                               $25, !6, ->68
        30    >   ASSIGN                                                   !7, ~26
  37    31        INIT_FCALL                                               'similar_text'
        32        SEND_VAR                                                 !5
        33        SEND_VAR                                                 !7
        34        DO_ICALL                                         $28     
        35        ASSIGN                                                   !8, $28
  38    36        STRLEN                                           ~30     !5
        37        DIV                                              ~31     !8, ~30
        38        IS_SMALLER                                       ~32     0.8, ~31
        39      > JMPNZ_EX                                         ~32     ~32, ->44
        40    >   STRLEN                                           ~33     !7
        41        DIV                                              ~34     !8, ~33
        42        IS_SMALLER                                       ~35     0.8, ~34
        43        BOOL                                             ~32     ~35
        44    > > JMPZ                                                     ~32, ->50
  39    45    >   ASSIGN_DIM                                               !9
        46        OP_DATA                                                  !6
  40    47        ASSIGN_DIM                                               !10
        48        OP_DATA                                                  !7
        49      > JMP                                                      ->67
  42    50    >   INIT_FCALL                                               'stripos'
        51        SEND_VAR                                                 !5
        52        SEND_VAR                                                 !7
        53        DO_ICALL                                         $38     
        54        IS_NOT_IDENTICAL                                 ~39     $38, <false>
        55      > JMPNZ_EX                                         ~39     ~39, ->62
        56    >   INIT_FCALL                                               'strpos'
        57        SEND_VAR                                                 !7
        58        SEND_VAR                                                 !5
        59        DO_ICALL                                         $40     
        60        IS_NOT_IDENTICAL                                 ~41     $40, <false>
        61        BOOL                                             ~39     ~41
        62    > > JMPZ                                                     ~39, ->67
  43    63    >   ASSIGN_DIM                                               !11
        64        OP_DATA                                                  !6
  44    65        ASSIGN_DIM                                               !10
        66        OP_DATA                                                  !7
        67    > > JMP                                                      ->29
        68    >   FE_FREE                                                  $25
        69      > JMP                                                      ->27
        70    >   FE_FREE                                                  $24
        71      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0