3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = array( 'abc' => 0, 'foo-bcd' => 1, 'foo-def' => 1, 'foo-xyz' => 0, ); $filtered = array_filter($input, function ($key) { return strpos($key, 'foo-') === 0; }, ARRAY_FILTER_USE_KEY); print_r($filtered);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJCse
function name:  (null)
number of ops:  12
compiled vars:  !0 = $input, !1 = $filtered
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    9     1        INIT_FCALL                                                   'array_filter'
          2        SEND_VAR                                                     !0
          3        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
   11     4        SEND_VAL                                                     ~3
          5        SEND_VAL                                                     2
    9     6        DO_ICALL                                             $4      
          7        ASSIGN                                                       !1, $4
   13     8        INIT_FCALL                                                   'print_r'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                                     
         11      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJCse
function name:  {closure:/in/lJCse:9}
number of ops:  5
compiled vars:  !0 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        FRAMELESS_ICALL_2                strpos              ~1      !0, 'foo-'
          2        IS_IDENTICAL                                         ~2      ~1, 0
          3      > RETURN                                                       ~2
   11     4*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.04 ms | 2602 KiB | 15 Q