3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "date_2018_08" => 81, "date_2018_09" => 70, "date_2018_10" => 70, "date_2018_11" => 95, "date_2018_12" => 75, "date_2019_01" => 91, "date_2019_02" => 78, "date_2019_03" => 95, "date_2019_04" => 68 ]; $year = 2019; $filtered = array_filter( $array, function ($key) use ($year) { $parts = explode("_", $key); return $parts[1] >= $year; }, 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/7djaj
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $year, !2 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, 2019
   15     2        INIT_FCALL                                               'array_filter'
   16     3        SEND_VAR                                                 !0
   17     4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          5        BIND_LEXICAL                                             ~5, !1
   20     6        SEND_VAL                                                 ~5
   21     7        SEND_VAL                                                 2
   15     8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !2, $6
   24    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > 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/7djaj
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $key, !1 = $year, !2 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   18     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '_'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
   19     7        FETCH_DIM_R                                      ~5      !2, 1
          8        IS_SMALLER_OR_EQUAL                              ~6      !1, ~5
          9      > RETURN                                                   ~6
   20    10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.81 ms | 1007 KiB | 16 Q