3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_errors',"1"); ini_set('display_startup_errors',"1"); ini_set('log_errors',"1"); ini_set('html_errors',"0"); /** * @copyright Alexey Kachalov <alex-kachalov@mail.ru> * @author Alexey Kachalov <alex-kachalov@mail.ru> * @access public * @see http://178.140.61.70/ * @license GNU Public Licence - Version 3 */ class core { public function __construct() { require_once(dirname(__FILE__).'/conf.class.php'); $this->conf = new conf($this); require_once(dirname(__FILE__).'/minecraftstatus.class.php'); $this->author(); } /** * Обновление статуса серверов * * @param [optional] * @param ... * @access public */ public function update() { $args = func_get_args(); if(sizeof($args)==0) { foreach($this->conf->list as $arg => $serv) { $this->get($serv['name'],$serv['host'],$serv['port'],$arg); } } else { if(sizeof($args)==1 and is_array($args[0])) { foreach($args[0] as $arg) { if(isset($this->conf->list[$arg])) { $serv = $this->conf->list[$arg]; $this->get($serv['name'],$serv['host'],$serv['port'],$arg); } } } else { foreach($args as $arg) { if(isset($this->conf->list[$arg])) { $serv = $this->conf->list[$arg]; $this->get($serv['name'],$serv['host'],$serv['port'],$arg); } } } } } /** * Получение статуса сервера и обновление картинки * * @access private * @param string $name название сервера(на картинке) * @param string $host ip сервера * @param string $port порт, который слушает сервер * @param $write[optional] Вывод(false) или запись(имя файла) картинки(по умолчанию false, то есть вывод) */ private function get($name, $host, $port, $write = false) { if(@$this->conf->cache[$write]['timestamp']<(time()-$this->conf->cachelife)) { $serv = new ms($host, $port, $this->conf->timeout); if($serv->Online) $this->pict($name, $serv->CurPlayers, $serv->MaxPlayers, $write); else $this->pict($name, 0, 0, $write); $this->conf->set_cache($write,array( 'timestamp'=>time(), 'min'=>$serv->CurPlayers, 'max'=>$serv->MaxPlayers )); } } public function author() { if(isset($_GET['author'])) die("Created by <a href='http://vk.com/ak1998'>Kachalov Alexey</a>(<a href='http://vk.com/kcraft'>KachalovCRAFT NET</a>)"); } /** * Рисование картинки * * @access private * @param string $name название сервера(на картинке) * @param int $current количество игроков в данный момент на сервере * @param int $max количество слотов * @param $write[optional] Вывод(false) или запись(имя файла) картинки(по умолчанию false, то есть вывод) * * FIXME: Рваные края статусбара */ private function pict($name, $current, $max, $write = false) { $imgbgfolder = $this->conf->sysf; $font = $imgbgfolder.$this->conf->font['name']; $fw = $this->conf->font['width']; $textcolor = $this->conf->font['color']; $prec_border = $this->conf->precent_border; $if_offline = $this->conf->if_server_off; $players_max = $max; $players = $current; if($players_max==0) { $players_max = 1; $players = $if_offline; } $prec = floor($players/$players_max*100); if($players>=$players_max) $prec = 100; $angle = floor($prec*360/100); $width = 132; $height = 132;/*img size*/ $im = imagecreatetruecolor($width, $height+30); $imbg1 = imagecreatefrompng($imgbgfolder.'bg.png'); $imbg2 = imagecreatefrompng($imgbgfolder.'bg2.png'); if($prec_border[0]>=$prec) { $imgcol = 'greenbar.png'; $barbg = 'greenbg.png'; } elseif($prec_border[1]>=$prec) { $imgcol = 'yellowbar.png'; $barbg = 'yellowbg.png'; } else { $imgcol = 'redbar.png'; $barbg = 'redbg.png'; } $imbg3 = imagecreatefrompng($imgbgfolder.$imgcol); $imbg4 = imagecreatefrompng($imgbgfolder.$barbg); imagefill($im, 0, 0, imagecolorallocatealpha($im,0, 0, 0, 127)); imagesavealpha($im, true); $fontsize = 16; $fh = 6; imagecopy ($im, $imbg1, 0, 0, 0, 0, $width, $height); imagecopy ($im, $imbg3, 0, 0, 0, 0, $width, $height); if($prec!=100)imagefilledarc($im, $height/2, $width/2, $height-17, $width-17, -90+$angle, -90, imagecolorallocate($im, 1, 1, 1), IMG_ARC_PIE); imagecopy ($im, $imbg2, 0, 0, 0, 0, $width, $height); imagecopy ($im, $imbg4, 0, 0, 0, 0, $width, $height); $tw1 = ($width - strlen($players)*$fw)/2; $curcolor1 = imagecolorallocate($im, $textcolor[0], $textcolor[1], $textcolor[2]); imagettftext($im, $fontsize, 0, $tw1, $width/2+$fh, $curcolor1, $font, $players); $tw2 = ($width - strlen($name)*($fw-2))/2; $curcolor2 = imagecolorallocate($im, $textcolor[0], $textcolor[1], $textcolor[2]); imagettftext($im, $fontsize, 0, $tw2, $width/2+$fh+80, $curcolor2, $font, $name); if($write==false) { //header('Content-Type: image/png'); imagepng($im); } else { imagepng($im, $imgbgfolder.'../cache/'.$write.'.png'); } imagedestroy($im); } } ?>

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.0.120.0030.00313.30
8.0.110.0030.00313.28
8.0.100.0030.00313.28
8.0.90.0000.00713.26
8.0.80.0040.00413.23
8.0.70.0090.00013.20
8.0.60.0020.00413.29
8.0.50.0050.00313.26
8.0.30.0090.00413.31
8.0.20.0110.00213.36
8.0.10.0050.00513.45
8.0.00.0060.00013.39
7.4.250.0030.00313.29
7.4.240.0050.00213.27
7.4.230.0000.00713.37
7.4.220.0040.00413.26
7.4.210.0000.00713.30
7.4.200.0040.00413.27
7.4.190.0020.00513.31
7.4.180.0070.00013.36
7.4.160.0000.00713.29
7.4.150.0060.00313.27
7.4.140.0040.00413.26
7.4.130.0030.00513.23
7.4.120.0040.00413.20
7.4.110.0050.00313.08
7.4.100.0050.00213.29
7.4.90.0050.00213.27
7.4.80.0020.00513.09
7.4.70.0000.00713.08
7.4.60.0020.00513.27
7.4.50.0040.00213.20
7.4.40.0020.00513.07
7.4.30.0070.00013.13
7.4.20.0000.00713.27
7.4.10.0070.00013.14
7.4.00.0000.00713.09
7.3.310.0030.00313.14
7.3.300.0030.00313.26
7.3.290.0000.00713.29
7.3.280.0070.00013.14
7.3.270.0040.00413.29
7.3.260.0030.00613.24
7.3.250.0060.00013.23
7.3.240.0000.00613.14
7.3.230.0030.00313.11
7.3.220.0050.00213.23
7.3.210.0040.00213.20
7.3.200.0020.00413.21
7.3.190.0020.00413.11
7.3.180.0060.00013.32
7.3.170.0020.00413.18
7.3.160.0030.00313.19
7.3.150.0000.00613.00
7.3.140.0000.00612.96
7.3.130.0050.00013.27
7.3.120.0030.00313.04
7.3.110.0000.00513.12
7.3.100.0000.00613.08
7.3.90.0030.00313.41
7.3.80.0030.00313.23
7.3.70.0040.00413.17
7.3.60.0000.00813.42
7.3.50.0050.00213.39
7.3.40.0000.00613.41
7.3.30.0030.00313.41
7.3.20.0000.00714.96
7.3.10.0000.01015.54
7.3.00.0050.00415.82
7.2.340.0090.00313.09
7.2.330.0110.00213.10
7.2.320.0060.00613.09
7.2.310.0060.00613.11
7.2.300.0100.00313.22
7.2.290.0090.00313.09
7.2.280.0070.00613.22
7.2.270.0150.00013.05
7.2.260.0080.00413.05
7.2.250.0080.00413.27
7.2.240.0130.00013.20
7.2.230.0120.00013.23
7.2.220.0000.01213.19
7.2.210.0120.00013.23
7.2.200.0070.00613.45
7.2.190.0000.01213.23
7.2.180.0130.00013.32
7.2.170.0090.00513.16
7.2.160.0080.00413.29
7.2.150.0090.00415.04
7.2.140.0130.00015.01
7.2.130.0110.00315.95
7.2.120.0040.01015.81
7.2.110.0080.00415.80
7.2.100.0070.00716.00
7.2.90.0080.00516.06
7.2.80.0070.00615.78
7.2.70.0080.00615.88
7.2.60.0100.00315.83
7.2.50.0030.00815.77
7.2.40.0090.00315.89
7.2.30.0090.00615.98
7.2.20.0070.00515.90
7.2.10.0050.00816.00
7.2.00.0100.00517.02
7.1.330.0000.01214.06
7.1.320.0090.00314.17
7.1.310.0090.00314.14
7.1.300.0060.00614.13
7.1.290.0120.00014.34
7.1.280.0120.00014.13
7.1.270.0060.00614.13
7.1.260.0090.00214.09
7.1.250.0050.00714.97
7.1.240.0040.00714.23
7.1.230.0080.00414.27
7.1.220.0080.00414.12
7.1.210.0060.00614.28
7.1.200.0130.00014.10
7.1.190.0090.00314.28
7.1.180.0000.01114.20
7.1.170.0060.00614.28
7.1.160.0000.01314.07
7.1.150.0110.00014.21
7.1.140.0090.00314.14
7.1.130.0000.01214.21
7.1.120.0110.00314.14
7.1.110.0120.00014.02
7.1.100.0040.00716.03
7.1.90.0060.00613.99
7.1.80.0090.00214.08
7.1.70.0050.00715.48
7.1.60.0040.01416.77
7.1.50.0080.00815.37
7.1.40.0100.00314.25
7.1.30.0060.00614.30
7.1.20.0060.00614.15
7.1.10.0060.00614.04
7.1.00.0080.03518.30
7.0.330.0070.00514.05
7.0.320.0050.00613.98
7.0.310.0040.00814.06
7.0.300.0090.00313.93
7.0.290.0080.00413.98
7.0.280.0120.00014.06
7.0.270.0060.00614.02
7.0.260.0070.00413.98
7.0.250.0060.00614.18
7.0.240.0060.00614.08
7.0.230.0060.00614.07
7.0.220.0120.00014.13
7.0.210.0060.00613.95
7.0.200.0090.00415.43
7.0.190.0130.00014.07
7.0.180.0120.00014.20
7.0.170.0080.00414.14
7.0.160.0100.00313.88
7.0.150.0120.00013.96
7.0.140.0150.03017.95
7.0.130.0060.00614.09
7.0.120.0090.00414.19
7.0.110.0090.00314.14
7.0.100.0130.00014.08
7.0.90.0070.03816.93
7.0.80.0080.02617.06
7.0.70.0110.03816.88
7.0.60.0080.04117.02
7.0.50.0050.04817.19
7.0.40.0120.03717.12
7.0.30.0080.04517.06
7.0.20.0140.05017.02
7.0.10.0080.04316.95
7.0.00.0050.03017.04
5.6.400.0080.00412.39
5.6.390.0000.01212.32
5.6.380.0090.00212.38
5.6.370.0040.00812.35
5.6.360.0090.00312.68
5.6.350.0000.01312.30
5.6.340.0120.00012.43
5.6.330.0130.00012.68
5.6.320.0100.00212.38
5.6.310.0060.00612.69
5.6.300.0040.00812.20
5.6.290.0100.00212.67
5.6.280.0050.04016.75
5.6.270.0080.00412.59
5.6.260.0120.00012.69
5.6.250.0090.00312.33
5.6.240.0130.03216.64
5.6.230.0050.04916.63
5.6.220.0060.04616.70
5.6.210.0040.02716.72
5.6.200.0090.04416.89
5.6.190.0080.02616.98
5.6.180.0070.03016.94
5.6.170.0110.04216.83
5.6.160.0090.04016.90
5.6.150.0090.02716.83
5.6.140.0040.02616.87
5.6.130.0030.04816.77
5.6.120.0140.04016.82
5.6.110.0070.04216.82
5.6.100.0070.04516.69
5.6.90.0080.03516.69
5.6.80.0100.03916.44
5.6.70.0070.02016.49
5.6.60.0090.02016.64
5.6.50.0040.04416.50
5.6.40.0100.03916.56
5.6.30.0080.02616.48
5.6.20.0060.04816.38
5.6.10.0120.03516.48
5.6.00.0110.03916.35
5.5.380.0090.04016.49
5.5.370.0070.04516.57
5.5.360.0090.04216.51
5.5.350.0090.03716.49
5.5.340.0080.04516.58
5.5.330.0110.03616.68
5.5.320.0070.04216.64
5.5.310.0100.04116.58
5.5.300.0140.03316.47
5.5.290.0070.03916.65
5.5.280.0110.04116.65
5.5.270.0080.04616.71
5.5.260.0090.04216.74
5.5.250.0110.03916.54
5.5.240.0100.03916.45
5.5.230.0130.02716.41
5.5.220.0100.02116.39
5.5.210.0060.04316.30
5.5.200.0100.02716.25
5.5.190.0070.04316.43
5.5.180.0080.04016.30
5.5.170.0070.00412.24
5.5.160.0090.03416.13
5.5.150.0060.02616.29
5.5.140.0050.02516.27
5.5.130.0080.03916.26
5.5.120.0090.02616.22
5.5.110.0090.04216.19
5.5.100.0110.01916.27
5.5.90.0070.04016.39
5.5.80.0050.03516.23
5.5.70.0100.03716.31
5.5.60.0090.02716.31
5.5.50.0050.03716.29
5.5.40.0050.02216.35
5.5.30.0110.04016.45
5.5.20.0140.03316.33
5.5.10.0070.04316.28
5.5.00.0080.03616.33
5.4.450.0070.03015.94
5.4.440.0070.04515.94
5.4.430.0130.03316.08
5.4.420.0110.03115.98
5.4.410.0090.04115.87
5.4.400.0100.03715.68
5.4.390.0070.02515.71
5.4.380.0070.02515.74
5.4.370.0090.03315.82
5.4.360.0070.04015.67
5.4.350.0060.03115.73
5.4.340.0040.02815.75
5.4.330.0090.00312.44
5.4.320.0090.03715.79
5.4.310.0090.04115.62
5.4.300.0090.03515.92
5.4.290.0070.04115.80
5.4.280.0070.04315.83
5.4.270.0110.03715.67
5.4.260.0110.03715.79
5.4.250.0060.03815.59
5.4.240.0100.01915.75
5.4.230.0060.03015.49
5.4.220.0080.04115.56
5.4.210.0040.04315.67
5.4.200.0050.02715.74
5.4.190.0060.02315.59
5.4.180.0110.03015.65
5.4.170.0070.02415.65
5.4.160.0080.03815.78
5.4.150.0090.04315.73
5.4.140.0050.04414.46
5.4.130.0050.02514.42
5.4.120.0080.03714.48
5.4.110.0030.04614.57
5.4.100.0090.03914.40
5.4.90.0070.03714.46
5.4.80.0040.02214.42
5.4.70.0060.03714.44
5.4.60.0080.03614.42
5.4.50.0100.03314.44
5.4.40.0120.03514.47
5.4.30.0050.03214.43
5.4.20.0050.03814.53
5.4.10.0090.02314.42
5.4.00.0070.02814.02
5.3.290.0090.03713.82
5.3.280.0100.03813.65
5.3.270.0090.03913.78
5.3.260.0080.04313.69
5.3.250.0080.04113.75
5.3.240.0030.03913.75
5.3.230.0090.04013.76
5.3.220.0080.03513.70
5.3.210.0060.04113.66
5.3.200.0050.04013.80
5.3.190.0100.03613.71
5.3.180.0060.03913.73
5.3.170.0110.03613.92
5.3.160.0140.03513.73
5.3.150.0100.04013.82
5.3.140.0060.02613.73
5.3.130.0050.04113.83
5.3.120.0080.04113.67
5.3.110.0030.04513.90
5.3.100.0090.03613.45
5.3.90.0050.04213.46
5.3.80.0080.01913.39
5.3.70.0060.01913.50
5.3.60.0100.03213.39
5.3.50.0100.02913.41
5.3.40.0050.04213.37
5.3.30.0040.03813.29
5.3.20.0090.03513.26
5.3.10.0070.03613.24
5.3.00.0090.03813.24

preferences:
37.4 ms | 401 KiB | 5 Q