3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_today() { $date_array = array( '28-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); var_dump($now == $match_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/ONBgJ
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     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 = 29
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/ONBgJ
function name:  is_today
number of ops:  31
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, ->29
          6    > > FE_FETCH_R                                               $9, !2, ->29
   31     7    >   NEW                                              $10     'DateTime'
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $10
   32    11        INIT_FCALL                                               'var_dump'
         12        IS_EQUAL                                         ~13     !1, !3
         13        SEND_VAL                                                 ~13
         14        DO_ICALL                                                 
   33    15        INIT_METHOD_CALL                                         !1, 'diff'
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0  $15     
         18        ASSIGN                                                   !4, $15
   34    19        FETCH_OBJ_R                                      ~17     !4, 'days'
         20        IS_IDENTICAL                                             ~17, 0
         21      > JMPZ                                                     ~18, ->26
   35    22    >   FE_FREE                                                  $9
         23      > RETURN                                                   <true>
   36    24*       JMP                                                      ->29
         25*       JMP                                                      ->28
   38    26    >   FE_FREE                                                  $9
         27      > RETURN                                                   <false>
   30    28*       JMP                                                      ->6
         29    >   FE_FREE                                                  $9
   41    30      > RETURN                                                   null

End of function is_today

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.29 ms | 1403 KiB | 16 Q