3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str=<<<TXT test something/action controller/test controller/another controller/action/something action action/test controller/another/somethingelse TXT; $config = array( 'test' => 'The description of test', 'something/action' => 'Some action description', 'controller/another' => 'Another description', 'controller/action/*' => 'This should match the `controller/action/blah` and everything similar like: `controller/action/something` and give this description', 'action' => 'Action description', 'action/*' => 'As the 2nd above, this should match the `action/test` itself, and similar like `action/anothertest` URI' ); foreach(explode("\n",$str) as $line) { $line=trim($line); $dkey=array_filter(array_keys($config),function($key)use($line){return fnmatch($key,$line);}); if(count($dkey)<=0) { echo "(no description)"; } else { echo $config[reset($dkey)]; } echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 34
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 34
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/KheIO
function name:  (null)
number of ops:  36
compiled vars:  !0 = $str, !1 = $config, !2 = $line, !3 = $dkey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'test%0Asomething%2Faction%0Acontroller%2Ftest%0Acontroller%2Fanother%0Acontroller%2Faction%2Fsomething%0Aaction%0Aaction%2Ftest%0Acontroller%2Fanother%2Fsomethingelse'
   12     1        ASSIGN                                                   !1, <array>
   20     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6      > FE_RESET_R                                       $7      $6, ->34
          7    > > FE_FETCH_R                                               $7, !2, ->34
   22     8    >   INIT_FCALL                                               'trim'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !2, $8
   23    12        INIT_FCALL                                               'array_filter'
         13        INIT_FCALL                                               'array_keys'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $10     
         16        SEND_VAR                                                 $10
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKheIO%3A23%240'
         18        BIND_LEXICAL                                             ~11, !2
         19        SEND_VAL                                                 ~11
         20        DO_ICALL                                         $12     
         21        ASSIGN                                                   !3, $12
   24    22        COUNT                                            ~14     !3
         23        IS_SMALLER_OR_EQUAL                                      ~14, 0
         24      > JMPZ                                                     ~15, ->27
   26    25    >   ECHO                                                     '%28no+description%29'
         26      > JMP                                                      ->32
   30    27    >   INIT_FCALL                                               'reset'
         28        SEND_REF                                                 !3
         29        DO_ICALL                                         $16     
         30        FETCH_DIM_R                                      ~17     !1, $16
         31        ECHO                                                     ~17
   32    32    >   ECHO                                                     '%0A'
   20    33      > JMP                                                      ->7
         34    >   FE_FREE                                                  $7
   33    35      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKheIO%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KheIO
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $key, !1 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'fnmatch'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKheIO%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.78 ms | 1400 KiB | 25 Q