3v4l.org

run code in 300+ PHP versions simultaneously
<?php function update_ipdb() { // check if we can update the database //global $pcm_localization; //$last_update = get_option( 'pcm_last_ipdb_update', '0|N/A' ); //$last_update = explode( '|', $last_update ); $last_update = '1445519411'; $last_month = strtotime( 'first wednesday of last month' ); $this_month = strtotime( 'first wednesday of this month' ); $today = time(); $recent_wed = $today > $this_month ? $this_month : $last_month; // identify most recent first wednesday (the nearest first wednesday in the past) /* Only Update if the following criteria are met: * 1. Current time is in the future of recent_wed and Last Update is not * 2. Auto Update is enabled */ if ( $today > $recent_wed && $last_update < $recent_wed && $this->options->general->geolocation->enable_auto_db_update ) { $ok = true; // check if all went well if ( $ok ) { echo 'yep'; } else { echo 'no'; } } } update_ipdb();

preferences:
32.62 ms | 402 KiB | 5 Q