3v4l.org

run code in 300+ PHP versions simultaneously
<?php define( 'MINUTE_IN_SECONDS', 60 ); define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS ); define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS ); define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS ); define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS ); function check_if_reminder_should_be_sent( $date ) { $this->log( 'Checking if reminder should be sent for: ' . $id ); $date = strtotime( str_replace( '-', ' ', $date ) . ', 2015' ); if ( time() > $date ) { return false; } $reminder_time = $reminder_time - ( DAY_IN_SECONDS ); if ( time() >= $reminder_time ) { $this->log( 'Reminder should be sent for ' . $id ); return true; } $this->log( 'Reminder should NOT be sent for ' . $id ); return false; } var_dump( check_if_reminder_should_be_sent( 'nov-24' ) ); var_dump( check_if_reminder_should_be_sent( 'dec-23' ) ); var_dump( check_if_reminder_should_be_sent( 'dec-24' ) ); var_dump( check_if_reminder_should_be_sent( 'dec-25' ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8mgPa
function name:  (null)
number of ops:  53
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'MINUTE_IN_SECONDS'
          2        SEND_VAL                                                 60
          3        DO_ICALL                                                 
    3     4        INIT_FCALL                                               'define'
          5        SEND_VAL                                                 'HOUR_IN_SECONDS'
          6        FETCH_CONSTANT                                   ~1      'MINUTE_IN_SECONDS'
          7        MUL                                              ~2      ~1, 60
          8        SEND_VAL                                                 ~2
          9        DO_ICALL                                                 
    4    10        INIT_FCALL                                               'define'
         11        SEND_VAL                                                 'DAY_IN_SECONDS'
         12        FETCH_CONSTANT                                   ~4      'HOUR_IN_SECONDS'
         13        MUL                                              ~5      ~4, 24
         14        SEND_VAL                                                 ~5
         15        DO_ICALL                                                 
    5    16        INIT_FCALL                                               'define'
         17        SEND_VAL                                                 'WEEK_IN_SECONDS'
         18        FETCH_CONSTANT                                   ~7      'DAY_IN_SECONDS'
         19        MUL                                              ~8      ~7, 7
         20        SEND_VAL                                                 ~8
         21        DO_ICALL                                                 
    6    22        INIT_FCALL                                               'define'
         23        SEND_VAL                                                 'YEAR_IN_SECONDS'
         24        FETCH_CONSTANT                                   ~10     'DAY_IN_SECONDS'
         25        MUL                                              ~11     ~10, 365
         26        SEND_VAL                                                 ~11
         27        DO_ICALL                                                 
   31    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'check_if_reminder_should_be_sent'
         30        SEND_VAL                                                 'nov-24'
         31        DO_FCALL                                      0  $13     
         32        SEND_VAR                                                 $13
         33        DO_ICALL                                                 
   32    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'check_if_reminder_should_be_sent'
         36        SEND_VAL                                                 'dec-23'
         37        DO_FCALL                                      0  $15     
         38        SEND_VAR                                                 $15
         39        DO_ICALL                                                 
   33    40        INIT_FCALL                                               'var_dump'
         41        INIT_FCALL                                               'check_if_reminder_should_be_sent'
         42        SEND_VAL                                                 'dec-24'
         43        DO_FCALL                                      0  $17     
         44        SEND_VAR                                                 $17
         45        DO_ICALL                                                 
   34    46        INIT_FCALL                                               'var_dump'
         47        INIT_FCALL                                               'check_if_reminder_should_be_sent'
         48        SEND_VAL                                                 'dec-25'
         49        DO_FCALL                                      0  $19     
         50        SEND_VAR                                                 $19
         51        DO_ICALL                                                 
         52      > RETURN                                                   1

Function check_if_reminder_should_be_sent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 34
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8mgPa
function name:  check_if_reminder_should_be_sent
number of ops:  41
compiled vars:  !0 = $date, !1 = $id, !2 = $reminder_time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_THIS                                       $3      
          2        INIT_METHOD_CALL                                         $3, 'log'
          3        CONCAT                                           ~4      'Checking+if+reminder+should+be+sent+for%3A+', !1
          4        SEND_VAL_EX                                              ~4
          5        DO_FCALL                                      0          
   10     6        INIT_FCALL                                               'strtotime'
          7        INIT_FCALL                                               'str_replace'
          8        SEND_VAL                                                 '-'
          9        SEND_VAL                                                 '+'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $6      
         12        CONCAT                                           ~7      $6, '%2C+2015'
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !0, $8
   12    16        INIT_FCALL                                               'time'
         17        DO_ICALL                                         $10     
         18        IS_SMALLER                                               !0, $10
         19      > JMPZ                                                     ~11, ->21
   13    20    > > RETURN                                                   <false>
   16    21    >   FETCH_CONSTANT                                   ~12     'DAY_IN_SECONDS'
         22        SUB                                              ~13     !2, ~12
         23        ASSIGN                                                   !2, ~13
   18    24        INIT_FCALL                                               'time'
         25        DO_ICALL                                         $15     
         26        IS_SMALLER_OR_EQUAL                                      !2, $15
         27      > JMPZ                                                     ~16, ->34
   20    28    >   FETCH_THIS                                       $17     
         29        INIT_METHOD_CALL                                         $17, 'log'
         30        CONCAT                                           ~18     'Reminder+should+be+sent+for+', !1
         31        SEND_VAL_EX                                              ~18
         32        DO_FCALL                                      0          
   22    33      > RETURN                                                   <true>
   25    34    >   FETCH_THIS                                       $20     
         35        INIT_METHOD_CALL                                         $20, 'log'
         36        CONCAT                                           ~21     'Reminder+should+NOT+be+sent+for+', !1
         37        SEND_VAL_EX                                              ~21
         38        DO_FCALL                                      0          
   27    39      > RETURN                                                   <false>
   28    40*     > RETURN                                                   null

End of function check_if_reminder_should_be_sent

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.56 ms | 1407 KiB | 27 Q