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();
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6
Fatal error: Uncaught Error: Using $this when not in object context in /in/4UdLb:19 Stack trace: #0 /in/4UdLb(33): update_ipdb() #1 {main} thrown in /in/4UdLb on line 19
Process exited with code 255.
Output for 5.5.0 - 5.5.37, 5.6.0 - 5.6.28
Fatal error: Using $this when not in object context in /in/4UdLb on line 19
Process exited with code 255.

preferences:
91.28 ms | 401 KiB | 85 Q