3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = array( 'store:key' => 1, 'user' => 'demo', 'store:foo' => 'bar', 'login' => true, ); if (PHP_VERSION_ID > 56000) { $return1 = array_filter($array, function ($e) { return strpos($e, 'store:') === 0; }, ARRAY_FILTER_USE_KEY); var_dump($return1); } $return2 = array_intersect_key($array, array_flip(array_filter(array_keys($array), function ($e) { return strpos($e, 'store:') === 0; }))); var_dump($return2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/UFtUU
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array, !1 = $return1, !2 = $return2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1      > JMPZ                                                         <true>, ->12
   12     2    >   INIT_FCALL                                                   'array_filter'
          3        SEND_VAR                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
   14     5        SEND_VAL                                                     ~4
          6        SEND_VAL                                                     2
   12     7        DO_ICALL                                             $5      
          8        ASSIGN                                                       !1, $5
   16     9        INIT_FCALL                                                   'var_dump'
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                                     
   19    12    >   INIT_FCALL                                                   'array_intersect_key'
         13        SEND_VAR                                                     !0
         14        INIT_FCALL                                                   'array_flip'
         15        INIT_FCALL                                                   'array_filter'
         16        INIT_FCALL                                                   'array_keys'
         17        SEND_VAR                                                     !0
         18        DO_ICALL                                             $8      
         19        SEND_VAR                                                     $8
         20        DECLARE_LAMBDA_FUNCTION                              ~9      [1]
   21    21        SEND_VAL                                                     ~9
   19    22        DO_ICALL                                             $10     
   21    23        SEND_VAR                                                     $10
   19    24        DO_ICALL                                             $11     
   21    25        SEND_VAR                                                     $11
   19    26        DO_ICALL                                             $12     
         27        ASSIGN                                                       !2, $12
   23    28        INIT_FCALL                                                   'var_dump'
         29        SEND_VAR                                                     !2
         30        DO_ICALL                                                     
         31      > 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/UFtUU
function name:  {closure:/in/UFtUU:12}
number of ops:  5
compiled vars:  !0 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   13     1        FRAMELESS_ICALL_2                strpos              ~1      !0, 'store%3A'
          2        IS_IDENTICAL                                         ~2      ~1, 0
          3      > RETURN                                                       ~2
   14     4*     > RETURN                                                       null

End of Dynamic Function 0

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

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.32 ms | 2664 KiB | 18 Q