3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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' ) );
based on 4RbUP
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/8mgPa:8 Stack trace: #0 /in/8mgPa(31): check_if_reminder_should_be_sent('nov-24') #1 {main} thrown in /in/8mgPa on line 8
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Using $this when not in object context in /in/8mgPa on line 8
Process exited with code 255.