3v4l.org

run code in 300+ 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}
number of ops:  8
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        INIT_FCALL                                               'str_starts_with'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.54 ms | 999 KiB | 16 Q