3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Hurricane Control Panel © 2014, a web control panel by Hurricane Development of http://www.HurricaneDevelopment.com is licenced under a Creative Commons Attribution-NoDerivatives 4.0 International License Permissions beyond the scope of this licence may be available at http://creativecommons.org/licenses/by-nd/4.0/ */ defined("_HEXEC") or die("This file may not be accessed directly"); class VARS { public static $errors = false; public static $extraJS = false; public static $scriptJS = false; public static $extraCSS = false; } abstract class GeneralUTIL { /** * Error functions * */ public static function addErr($err) { VARS::$errors[] = $err; } public static function logger($content, $level = LOGGER_INFO) { if (!file_exists("logs")) { mkdir("logs"); } $scanned_directory = array_diff(scandir("logs", SCANDIR_SORT_DESCENDING), array('..', '.')); $logs = false; if (sizeof($scanned_directory) == 0) { file_put_contents("logs/log.1", "", LOCK_EX); chmod("logs/log.1", 0600); $logid = 1; } else { foreach ($scanned_directory as $key => $value) { if (strpos($value, "log.") !== false) { $logs[] = $value; } } $logid = explode(".", $logs[0]); $logid = $logid[1]; if (filesize("logs/log." . $logid) >= 200000) { $logid = ((int) $logid) + 1; file_put_contents("logs/log." . $logid, "", LOCK_EX); chmod("logs/log." . $logid, 0600); } } date_default_timezone_set("America/New_York"); $d = getdate(); file_put_contents("logs/log." . $logid, "{$d['mon']}/{$d['mday']}/{$d['year']} {$d['hours']}:{$d['minutes']}:{$d['seconds']} $level $content \n", FILE_APPEND | LOCK_EX); } public static function sha512($password, $salt = null) { if ($salt == null) { $cost = 50000; $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.'); $salt = sprintf('$6$rounds=%d$', $cost) . $salt; } return crypt($password, $salt); } public static function matchSha512($password, $hash) { if (crypt($password, $hash) === $hash) { return true; } return false; } } class PluginUTIL extends GeneralUTIL { public static function addJS($jsPath) { $debugArray = debug_backtrace(); $pluginAlias = UTIL::getBetween($debugArray[0]['file'], "/plugins/plugin_", "/"); if ($pluginAlias == false) { UTIL::addErr("The addJS Method was not called from a registered plugin"); return false; } $pluginLoader = new Plugins(); $pluginLoader->loadPlugins(); $plugins = $pluginLoader->getPluginsArray(); foreach ($plugins as $id => $pluginArray) { if ($pluginArray['alias'] == $pluginAlias) { VARS::$extraJS[] = PATH . "plugins/plugin_" . $pluginAlias . "/" . $jsPath; return true; } } } public static function addScriptJS($script) { VARS::$scriptJS = $script; } public static function addCSS($cssPath) { $debugArray = debug_backtrace(); $pluginAlias = UTIL::getBetween($debugArray[0]['file'], "/plugins/plugin_", "/"); if ($pluginAlias == false) { UTIL::addErr("The addCSS Method was not called from a registered plugin"); return false; } $pluginLoader = new Plugins(); $pluginLoader->loadPlugins(); $plugins = $pluginLoader->getPluginsArray(); foreach ($plugins as $id => $pluginArray) { if ($pluginArray['alias'] == $pluginAlias) { VARS::$extraCSS[] = PATH . "plugins/plugin_" . $pluginAlias . "/" . $cssPath; return true; } } } } class UTIL extends GeneralUTIL { public static function displayErrors($output) { if (VARS::$errors != false && is_array(VARS::$errors)) { $output = str_replace("<div id='errors' class='alert alert-danger'></div>", "<div id='errors' class='alert alert-danger'><h1>Uh Oh. Some errors occured!</h1>" . implode("<br>", VARS::$errors) . "</div>", $output); } else { $output = str_replace("<div id='errors' class='alert alert-danger'></div>", "", $output); } return $output; } /** * Custom JS /CSS functions * */ public static function addCustomJSFromPath($path) { VARS::$extraJS[] = PATH . $path; } public static function includeCustomCSS($output) { if (VARS::$extraCSS != false && is_array(VARS::$extraCSS)) { $css = ""; foreach (VARS::$extraCSS as $key => $path): $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$path\">\n"; endforeach; $output = str_replace("CUSTOMCSSAREAHERE", $css, $output); } else { $output = str_replace("CUSTOMCSSAREAHERE", "", $output); } return $output; } /** * Get Between two strings function * */ public static function getBetween($content, $start, $end) { if (preg_match('/' . str_replace("/", "\\/", $start) . '(.*?)' . str_replace("/", "\\/", $end) . '/', $content, $res) === false) { return false; } return $res[1]; } /** * Redirect page function * */ public static function redirect($location, $code = '302') { switch ($code) { case '301'; header("HTTP/1.1 301 Moved Permanently"); break; case '303'; header("HTTP/1.1 303 See Other"); break; case '404'; header('HTTP/1.1 404 Not Found'); break; } //remove any &amp; in the url to prevent any problems $location = str_replace('&amp;', '&', $location); header("Location: $location"); //kill the script from running and output a link for browsers which enable turning off header redirects *cough Opera cough* :P exit('<a href="' . $location . '">If you were not redirected automatically please click here</a>'); } }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.40.0100.00618.67
8.3.30.0070.00719.02
8.3.20.0080.00020.16
8.3.10.0080.00020.23
8.3.00.0050.00319.38
8.2.170.0090.00622.96
8.2.160.0110.00420.51
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0080.00022.20
8.2.110.0090.00020.32
8.2.100.0110.00018.09
8.2.90.0000.00819.13
8.2.80.0090.00017.97
8.2.70.0040.00417.63
8.2.60.0030.00718.03
8.2.50.0040.00818.07
8.2.40.0040.00418.02
8.2.30.0030.00718.13
8.2.20.0040.00417.82
8.2.10.0030.00518.20
8.2.00.0050.00317.69
8.1.270.0040.00422.13
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.69
8.1.230.0040.00719.34
8.1.220.0050.00317.79
8.1.210.0000.00818.77
8.1.200.0060.00317.38
8.1.190.0060.00317.25
8.1.180.0050.00318.10
8.1.170.0060.00318.66
8.1.160.0030.00622.09
8.1.150.0070.00018.89
8.1.140.0030.00517.32
8.1.130.0000.00817.84
8.1.120.0040.00417.46
8.1.110.0030.00517.46
8.1.100.0070.00017.48
8.1.90.0000.00717.33
8.1.80.0050.00317.53
8.1.70.0030.00317.41
8.1.60.0000.00917.65
8.1.50.0030.00617.56
8.1.40.0040.00417.44
8.1.30.0040.00417.55
8.1.20.0000.00817.50
8.1.10.0080.00017.39
8.1.00.0030.00517.50
8.0.300.0070.00018.77
8.0.290.0040.00416.88
8.0.280.0040.00418.44
8.0.270.0000.00717.18
8.0.260.0030.00317.18
8.0.250.0000.00717.00
8.0.240.0030.00317.01
8.0.230.0040.00417.02
8.0.220.0000.00716.98
8.0.210.0050.00316.90
8.0.200.0060.00016.91
8.0.190.0050.00317.05
8.0.180.0040.00416.91
8.0.170.0040.00416.86
8.0.160.0000.00716.93
8.0.150.0030.00316.95
8.0.140.0030.00516.80
8.0.130.0030.00313.35
8.0.120.0050.00514.60
8.0.110.0060.00414.53
8.0.100.0040.00614.55
8.0.90.0060.00414.50
8.0.80.0070.00614.50
8.0.70.0090.00114.49
8.0.60.0090.00114.59
8.0.50.0060.00514.54
8.0.30.0120.00415.28
8.0.20.0050.01115.42
8.0.10.0070.00314.65
8.0.00.0060.00615.10
7.4.330.0000.00515.00
7.4.320.0030.00316.63
7.4.300.0060.00016.63
7.4.290.0030.00316.53
7.4.280.0030.00516.63
7.4.270.0000.00716.55
7.4.260.0040.00716.58
7.4.250.0060.00714.39
7.4.240.0090.00214.95
7.4.230.0070.00514.43
7.4.220.0090.00514.34
7.4.210.0100.00714.36
7.4.200.0080.00214.36
7.4.190.0100.00213.32
7.4.180.0100.00213.40
7.4.160.0040.00814.45
7.4.150.0060.00614.66
7.4.140.0070.00915.45
7.4.130.0080.00614.82
7.4.120.0060.01014.87
7.4.110.0090.00514.26
7.4.100.0120.00314.33
7.4.90.0060.00814.24
7.4.80.0080.00515.21
7.4.70.0090.00514.33
7.4.60.0080.00614.28
7.4.50.0050.00514.25
7.4.40.0070.00714.24
7.4.30.0090.00514.34
7.4.20.0060.00413.17
7.4.10.0070.00714.15
7.4.00.0060.00914.25
7.3.330.0030.00213.26
7.3.320.0060.00013.20
7.3.310.0080.00214.20
7.3.300.0040.00414.22
7.3.290.0110.00314.18
7.3.280.0050.01015.03
7.3.270.0090.00514.67
7.3.260.0080.00714.29
7.3.250.0100.00714.82
7.3.240.0100.00414.15
7.3.230.0070.00714.27
7.3.220.0100.00113.22
7.3.210.0090.00514.21
7.3.200.0060.00715.18
7.3.190.0100.00514.26
7.3.180.0080.00514.26
7.3.170.0090.00614.31
7.3.160.0070.00614.14
7.3.150.0030.00813.23
7.3.140.0110.00013.09
7.3.130.0070.00713.99
7.3.120.0060.00814.07
7.3.110.0040.01114.05
7.3.100.0090.00313.95
7.3.90.0060.00814.17
7.3.80.0060.00814.06
7.3.70.0080.00414.06
7.3.60.0050.00713.98
7.3.50.0060.00714.08
7.3.40.0080.00614.08
7.3.30.0030.00914.06
7.3.20.0090.00415.70
7.3.10.0060.00915.90
7.3.00.0060.00315.87
7.2.340.0020.01013.18
7.2.330.0080.00914.36
7.2.320.0090.00514.46
7.2.310.0100.00614.34
7.2.300.0100.00514.55
7.2.290.0100.00414.35
7.2.280.0100.00213.15
7.2.270.0090.00413.19
7.2.260.0080.00714.21
7.2.250.0090.00714.24
7.2.240.0080.00514.27
7.2.230.0060.00714.23
7.2.220.0050.00814.20
7.2.210.0090.00514.14
7.2.200.0070.00714.11
7.2.190.0060.00714.29
7.2.180.0080.00614.19
7.2.170.0080.00614.23
7.2.160.0070.00514.16
7.2.150.0050.00815.92
7.2.140.0060.00716.08
7.2.130.0060.00816.11
7.2.120.0060.00916.21
7.2.110.0060.00516.10
7.2.100.0090.00616.19
7.2.90.0070.00716.17
7.2.80.0060.00616.14
7.2.70.0070.00616.03
7.2.60.0080.00616.18
7.2.50.0060.00716.18
7.2.40.0060.00916.13
7.2.30.0060.00716.25
7.2.20.0110.00416.22
7.2.10.0060.00816.21
7.2.00.0070.00616.75
7.1.330.0070.00614.90
7.1.320.0050.00614.85
7.1.310.0090.00214.89
7.1.300.0050.00614.97
7.1.290.0060.00814.88
7.1.280.0080.00514.87
7.1.270.0060.00614.97
7.1.260.0030.00714.94
7.1.250.0050.00914.95
7.1.240.0090.00514.91
7.1.230.0030.00914.79
7.1.220.0060.00715.06
7.1.210.0090.00414.98
7.1.200.0080.00514.95
7.1.190.0090.00414.92
7.1.180.0100.00314.90
7.1.170.0060.00414.91
7.1.160.0090.00414.87
7.1.150.0050.00614.93
7.1.140.0090.00414.90
7.1.130.0090.00415.01
7.1.120.0100.00314.78
7.1.110.0100.00214.87
7.1.100.0050.00715.41
7.1.90.0080.00414.82
7.1.80.0070.00714.94
7.1.70.0060.00615.15
7.1.60.0070.00715.69
7.1.50.0090.00515.27
7.1.40.0070.00414.89
7.1.30.0090.00514.96
7.1.20.0080.00514.94
7.1.10.0060.00714.94
7.1.00.0050.01916.31
7.0.330.0090.00314.71
7.0.320.0050.00614.74
7.0.310.0060.00614.59
7.0.300.0050.00714.62
7.0.290.0080.00514.58
7.0.280.0070.00614.67
7.0.270.0080.00214.63
7.0.260.0070.00614.73
7.0.250.0080.00614.63
7.0.240.0090.00314.87
7.0.230.0040.00514.68
7.0.220.0030.00914.63
7.0.210.0050.00714.78
7.0.200.0040.00515.11
7.0.190.0050.00714.73
7.0.180.0040.00714.57
7.0.170.0070.00414.71
7.0.160.0080.00314.67
7.0.150.0060.00814.65
7.0.140.0080.01816.14
7.0.130.0060.00614.67
7.0.120.0050.00714.68
7.0.110.0050.00714.72
7.0.100.0080.01715.75
7.0.90.0070.01315.74
7.0.80.0060.01415.59
7.0.70.0070.01315.70
7.0.60.0080.01215.67
7.0.50.0110.00915.84
7.0.40.0050.01815.08
7.0.30.0080.01315.02
7.0.20.0070.01315.00
7.0.10.0090.01115.04
7.0.00.0060.01315.06
5.6.400.0050.00513.46
5.6.390.0050.00713.57
5.6.380.0060.00513.46
5.6.370.0060.00513.51
5.6.360.0040.00913.55
5.6.350.0090.00213.44
5.6.340.0060.00713.45
5.6.330.0090.00113.52
5.6.320.0050.00713.44
5.6.310.0080.00613.37
5.6.300.0080.00413.38
5.6.290.0040.00813.43
5.6.280.0070.01815.04
5.6.270.0020.00913.40
5.6.260.0110.00113.30
5.6.250.0050.02214.86
5.6.240.0040.01914.86
5.6.230.0090.01214.97
5.6.220.0070.01314.89
5.6.210.0080.01515.00
5.6.200.0060.01414.97
5.6.190.0050.01515.06
5.6.180.0060.01214.94
5.6.170.0070.01514.99
5.6.160.0080.01414.99
5.6.150.0070.02015.15
5.6.140.0060.01314.95
5.6.130.0040.01715.08
5.6.120.0060.01314.93
5.6.110.0070.01314.93
5.6.100.0050.01514.90
5.6.90.0090.01114.93
5.6.80.0090.01114.84
5.6.70.0070.01014.79
5.6.60.0060.01314.83
5.6.50.0090.01914.80
5.6.40.0080.01914.83
5.6.30.0090.01714.87
5.6.20.0050.02114.79
5.6.10.0050.02014.77
5.6.00.0070.02014.84
5.5.380.0060.01214.93
5.5.370.0070.01214.88
5.5.360.0050.01414.81
5.5.350.0070.01414.81
5.5.340.0110.01114.92
5.5.330.0050.01614.85
5.5.320.0100.01614.78
5.5.310.0070.01414.87
5.5.300.0070.01114.87
5.5.290.0060.01314.84
5.5.280.0060.01414.78
5.5.270.0100.01614.90
5.5.260.0070.01514.84
5.5.250.0060.01314.86
5.5.240.0060.01214.71
5.5.230.0050.01314.74
5.5.220.0070.01114.73
5.5.210.0060.01814.77
5.5.200.0060.02114.64
5.5.190.0100.01614.60
5.5.180.0060.02214.63
5.5.170.0070.00613.28
5.5.160.0050.01814.65
5.5.150.0070.01214.60
5.5.140.0070.02014.52
5.5.130.0080.01914.53
5.5.120.0080.01514.54
5.5.110.0060.02114.54
5.5.100.0070.02014.69
5.5.90.0060.01714.66
5.5.80.0040.02314.57
5.5.70.0090.02114.79
5.5.60.0060.02014.72
5.5.50.0060.02114.76
5.5.40.0080.01914.66
5.5.30.0070.01814.65
5.5.20.0060.02114.73
5.5.10.0060.02114.65
5.5.00.0060.02114.51
5.4.450.0050.01213.79
5.4.440.0070.01113.79
5.4.430.0060.01413.81
5.4.420.0060.01413.78
5.4.410.0040.01113.67
5.4.400.0070.01713.65
5.4.390.0030.01113.69
5.4.380.0050.01213.74
5.4.370.0070.01713.75
5.4.360.0080.01713.66
5.4.350.0060.01913.71
5.4.340.0040.01913.72
5.4.330.0060.00612.35
5.4.320.0070.01713.66
5.4.310.0060.01813.70
5.4.300.0090.01513.73
5.4.290.0090.01713.75
5.4.280.0040.02213.70
5.4.270.0030.02113.74
5.4.260.0070.01213.77
5.4.250.0070.01913.67
5.4.240.0080.01713.69
5.4.230.0060.01813.66
5.4.220.0060.01813.64
5.4.210.0060.01813.61
5.4.200.0060.01813.58
5.4.190.0090.01713.58
5.4.180.0070.01913.62
5.4.170.0040.01913.66
5.4.160.0050.02113.64
5.4.150.0100.01513.66
5.4.140.0060.01913.11
5.4.130.0080.01713.11
5.4.120.0060.01813.16
5.4.110.0070.01613.23
5.4.100.0070.01313.21
5.4.90.0060.01913.22
5.4.80.0040.01513.23
5.4.70.0080.01513.16
5.4.60.0050.01913.21
5.4.50.0070.01713.21
5.4.40.0050.01813.14
5.4.30.0080.01413.17
5.4.20.0050.01813.25
5.4.10.0070.01413.21
5.4.00.0070.01812.94

preferences:
49.94 ms | 400 KiB | 5 Q