3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_today() { $date_array = array( '29-10-2018', '4-11-2018', '25-11-2018', '2-12-2018', '16-12-2018', '23-12-2018', '30-12-2018', '27-01-2019', '24-02-2019', '31-03-2019', '14-04-2019', '28-04-2019', '26-05-2019', '30-06-2019', '28-07-2019', '25-08-2019', '29-09-2019', '27-10-2019', '24-11-2019', '15-12-2019', '22-12-2019', '29-12-2019' ); $now = new DateTime("now"); // foreach($date_array as $date) { $match_date = new DateTime($date); $interval = $now->diff($match_date); if($interval->days == 0) { return true; break; } else { return false; } } } var_dump(is_today());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dL4MY
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'is_today'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   1

Function is_today:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 25
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/dL4MY
function name:  is_today
number of ops:  27
compiled vars:  !0 = $date_array, !1 = $now, !2 = $date, !3 = $match_date, !4 = $interval
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   28     1        NEW                                              $6      'DateTime'
          2        SEND_VAL_EX                                              'now'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $6
   30     5      > FE_RESET_R                                       $9      !0, ->25
          6    > > FE_FETCH_R                                               $9, !2, ->25
   31     7    >   NEW                                              $10     'DateTime'
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $10
   32    11        INIT_METHOD_CALL                                         !1, 'diff'
         12        SEND_VAR_EX                                              !3
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !4, $13
   33    15        FETCH_OBJ_R                                      ~15     !4, 'days'
         16        IS_EQUAL                                                 ~15, 0
         17      > JMPZ                                                     ~16, ->22
   34    18    >   FE_FREE                                                  $9
         19      > RETURN                                                   <true>
   35    20*       JMP                                                      ->25
         21*       JMP                                                      ->24
   37    22    >   FE_FREE                                                  $9
         23      > RETURN                                                   <false>
   30    24*       JMP                                                      ->6
         25    >   FE_FREE                                                  $9
   40    26      > RETURN                                                   null

End of function is_today

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.51 ms | 1399 KiB | 16 Q