3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 'abc' => 0, 'foo-bcd' => 1, 'foo-def' => 1, 'foo-xyz' => 0, ]; $prefix = 'foo'; var_export( array_filter( $array, fn($key) => str_starts_with($key, $prefix), ARRAY_FILTER_USE_KEY ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nog5U
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $prefix
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1        ASSIGN                                                       !1, 'foo'
   12     2        INIT_FCALL                                                   'var_export'
   13     3        INIT_FCALL                                                   'array_filter'
   14     4        SEND_VAR                                                     !0
   15     5        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          6        BIND_LEXICAL                                                 ~4, !1
          7        SEND_VAL                                                     ~4
   16     8        SEND_VAL                                                     2
   13     9        DO_ICALL                                             $5      
   16    10        SEND_VAR                                                     $5
   12    11        DO_ICALL                                                     
   18    12      > 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/Nog5U
function name:  {closure:/in/Nog5U:15}
number of ops:  5
compiled vars:  !0 = $key, !1 = $prefix
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        FRAMELESS_ICALL_2                str_starts_with      ~2      !0, !1
          3      > RETURN                                                       ~2
          4*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.78 ms | 2128 KiB | 15 Q