3v4l.org

run code in 300+ 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}
number of ops:  8
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'foo-'
          4        DO_ICALL                                         $1      
          5        IS_IDENTICAL                                     ~2      $1, 0
          6      > RETURN                                                   ~2
   11     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.13 ms | 1438 KiB | 16 Q