3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'plugin-folder/one' => 'one', 'plugin-folder/two' => 'two', 'muplugins/hey' => 'hey', 'vendor/laravel' => 'laravel' ]; $prefix = 'plugin-folder/'; $filtered = array_filter(array_keys($arr), function($key) use ($prefix) { return strpos($key, $prefix) === 0; }); var_dump($filtered);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vYhRY
function name:  (null)
number of ops:  16
compiled vars:  !0 = $arr, !1 = $prefix, !2 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, 'plugin-folder%2F'
   12     2        INIT_FCALL                                               'array_filter'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FvYhRY%3A12%240'
          8        BIND_LEXICAL                                             ~6, !1
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
   13    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FvYhRY%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.68 ms | 1400 KiB | 21 Q