3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Current Configuration Analyzer * * @since 2.0 * @version 2.0-alpha * @copyright 2009-2014 YOURLS * @license MIT */ namespace YOURLS\Configuration; use YOURLS\Extensions\Filters; class Configuration { /** * Check if an upgrade is needed * */ public function upgrade_is_needed() { // check YOURLS_DB_VERSION exist && match values stored in YOURLS_DB_TABLE_OPTIONS list( $current_ver, $current_sql ) = Environment::current_version(); return $current_sql < YOURLS_DB_VERSION; } /** * * @since 2.0 * @todo Review and PHPDoc */ public static function is( $config ) { if ( defined( 'YOURLS_' . strtoupper( $config ) ) && is_bool( constant( 'YOURLS_' . strtoupper( $config ) ) ) ) { return constant( 'YOURLS_' . strtoupper( $config ) ); } if ( method_exists( $this, 'is_' . $config ) ) { return call_user_func(array( $this, 'is_' . $config ) ); } return false; } /** * Determine if the current page is private * */ public function is_privated() { $private = false; if ( defined( 'YOURLS_PRIVATE' ) && YOURLS_PRIVATE == true ) { // Allow overruling for particular pages: // API if( is_API() ) { if( !defined( 'YOURLS_PRIVATE_API' ) || YOURLS_PRIVATE_API != false ) $private = true; // Infos } elseif( is_infos() ) { if( !defined( 'YOURLS_PRIVATE_INFOS' ) || YOURLS_PRIVATE_INFOS !== false ) $private = true; // Others } else { $private = true; } } return Filters::apply_filter( 'is_private', $private ); } /** * Allow several short URLs for the same long URL ? * */ public function allow_duplicate_longurls() { // special treatment if API to check for WordPress plugin requests if( is_API() ) { if ( isset( $_REQUEST[ 'source' ] ) && $_REQUEST[ 'source' ] == 'plugin' ) return false; } return ( defined( 'UNIQUE_URLS' ) && UNIQUE_URLS == false ); } /** * Check if YOURLS is installed * * @todo Review completely this function with a try catch when connecting database */ public function is_installed() { global $ydb; $is_installed = ( property_exists( $ydb, 'installed' ) && $ydb->installed == true ); return $is_installed; } /** * Check if we'll need interface display function (i.e. not API or redirection) * */ public function has_interface() { return is( 'api' ) || is( 'go' ); } /** * Check if current session is valid and secure as configured * */ public function is_public_or_logged() { if ( !is_privated() ) return true; else return defined( 'YOURLS_USER' ); } /** * Check for maintenance mode. If yes, die. See maintenance_mode(). Stolen from WP. * * @todo Rewrite and fix die */ public function check_maintenance_mode() { $file = YOURLS_ABSPATH . '/.maintenance' ; if ( !file_exists( $file ) || is_upgrading() || is_installing() ) return; global $maintenance_start; include_once( $file ); // If the $maintenance_start timestamp is older than 10 minutes, don't die. if ( ( time() - $maintenance_start ) >= 600 ) return; // Use any /user/maintenance.php file if( file_exists( YOURLS_USERDIR.'/maintenance.php' ) ) { include_once( YOURLS_USERDIR.'/maintenance.php' ); die(); } // https://www.youtube.com/watch?v=Xw-m4jEY-Ns $title = _( 'Service temporarily unavailable' ); $message = _( 'Our service is currently undergoing scheduled maintenance.' ) . "</p><p>" . _( 'Things should not last very long, thank you for your patience and please excuse the inconvenience' ); die( $message/*, $title , 503 */); } }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.24, 8.0.0 - 8.0.11
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING in /in/voFaq on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/voFaq on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/voFaq on line 12
Process exited with code 255.

preferences:
233.71 ms | 401 KiB | 274 Q