3v4l.org

run code in 300+ PHP versions simultaneously
<?php $item['event_dates_1'] = [ ['event_date' => '2020-04-02 00:00:00'], ['event_date' => '2020-04-07 00:00:00'], ['event_date' => '2020-12-18 00:00:00'], ]; $now = new \DateTime(); $newDates = array_filter( $item['event_dates_1'], function($event) use ($now) { return $now < (new \DateTime($event['event_date'])); } ); print_r($newDates);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2WfLk
function name:  (null)
number of ops:  17
compiled vars:  !0 = $item, !1 = $now, !2 = $newDates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0, 'event_dates_1'
    4     1        OP_DATA                                                  <array>
    9     2        NEW                                              $4      'DateTime'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   10     5        INIT_FCALL                                               'array_filter'
   11     6        FETCH_DIM_R                                      ~7      !0, 'event_dates_1'
          7        SEND_VAL                                                 ~7
   12     8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2WfLk%3A12%240'
          9        BIND_LEXICAL                                             ~8, !1
   14    10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
   10    12        ASSIGN                                                   !2, $9
   16    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F2WfLk%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2WfLk
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $event, !1 = $now
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   13     2        NEW                                              $2      'DateTime'
          3        CHECK_FUNC_ARG                                           
          4        FETCH_DIM_FUNC_ARG                               $3      !0, 'event_date'
          5        SEND_FUNC_ARG                                            $3
          6        DO_FCALL                                      0          
          7        IS_SMALLER                                       ~5      !1, $2
          8      > RETURN                                                   ~5
   14     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2WfLk%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.26 ms | 1400 KiB | 17 Q