3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(empty($dataFile)) {echo"无数据文件!";} else { $point=6; $data_x=array(); $data_y=array(); $x=array(); $file=$dataFile; $file_hander=fopen($file,"rb"); while(!feof($file_hander)) { $buffer=fgets($file_hander); array_push($x,$buffer); } for($i=0;$i<sizeof($x)-1;$i++) { $data=explode(" ",$x[$i]); array_push($data_x,$data[0]); array_push($data_y,substr($data[1],0,-2)); } /*for($i=0;$i<sizof($data_x);$i++) { echo"[".$data_x[$i].",".$data_y[$i]."]<br>"; }*/ if(sizeof($data_x)==sizeof($data_y))//横纵坐标的个数相同 { header("Content-type:image/png"); $imgWidth=600;$imgHeight=600;$cha=50; $image=imagecreate($imgWidth+80,$imgHeight+80); $colorWhite=imagecolorallocate($image,255,255,255); $raxi=imagecolorallocate($image,255,0,0);//#ABA9A5 $raxi_o=imagecolorallocate($image,0,255,0); $net=imagecolorallocate($image,153,204,255);//#99CCFF $zuobiao=imagecolorallocate($image,255,153,0);//#FF9900 //分别求一下横纵坐标的最大最小值 $max_x=$min_x=$data_x[0]; $min_y=$max_y=$data_y[0]; for($i=1;$i<sizeof($data_x);$i++) { $max_x=$max_x>$data_x[$i]?$max_x:$data_x[$i]; $min_x=$min_x<$data_x[$i]?$min_x:$data_x[$i]; $max_y=$max_y>$data_y[$i]?$max_y:$data_y[$i]; $min_y=$min_y<$data_y[$i]?$min_y:$data_y[$i]; } $num=20; $bit_x=($max_x-$min_x)/$imgWidth;//X轴实际与显示的比例 $step_x=30*$bit_x; $bit_y=($max_y-$min_y)/$imgHeight;//Y轴实际与显示的比例 $step_y=30*$bit_y; /*for($i=0;$i<sizeof($data_x);$i++) echo $data_x[$i]." ";*/ for($i=0;$i<=$num;$i++)//坐标轴 { imageline($image,($i*30),($imgHeight),(30*($i+1)),($imgHeight),$raxi);//注意,只要画出20个方格即可,不需考虑数据 if($i%2==0) imagestring($image,2,($i*30),$imgHeight+5,($min_x+$i*$step_x),$raxi_o);//X轴数据 else imagestring($image,2,($i*30),$imgHeight+5,($min_x+$i*$step_x),$raxi); imageline($image,0,$imgHeight-30*$i,0,$imgHeight-30*($i+1),$raxi); if($i%2==0) imagestring($image,2,10,$imgHeight-30*$i,($min_y+$i*$step_y),$raxi); else imagestring($image,2,10,$imgHeight-30*$i,($min_y+$i*$step_y),$raxi_o); } for($i=1;$i<=20;$i++)//垂线 { imageline($image,30*$i,$imgHeight,30*$i,0,$net); imageline($image,0,$imgHeight-30*$i,$imgWidth,$imgHeight-30*$i,$net); } for($i=0;$i<sizeof($data_x)-1;$i++)//画点与点之间的连线 { imageline($image,($data_x[$i]-$min_x)/$bit_x,($imgHeight-($data_y[$i]-$min_y)/$bit_y),($data_x[$i+1]-$min_x)/$bit_x,($imgHeight-($data_y[$i+1]-$min_y)/$bit_y),$raxi); } for($i=0;$i<sizeof($data_x);$i++) { $show_thing="[".$data_x[$i].",".$data_y[$i]."]"; for($j=0;$j<$point;$j++)//画坐标点 imagearc($image,($data_x[$i]-$min_x)/$bit_x,($imgHeight-($data_y[$i]-$min_y)/$bit_y),$j,$j,0,360,$raxi); imagestring($image,2,($data_x[$i]-$min_x)/$bit_x,($imgHeight-($data_y[$i]-$min_y)/$bit_y),$show_thing,$zuobiao); } imagepng($image); imagedestroy($image); } else echo"横纵坐标的个数不同!请检查一下原文件!"; } ?>

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.60.0140.00718.18
8.3.50.0170.01221.09
8.3.40.0110.00418.58
8.3.30.0110.00420.29
8.3.20.0080.00018.87
8.3.10.0040.00420.97
8.3.00.0000.00723.50
8.2.180.0180.00416.75
8.2.170.0040.01122.96
8.2.160.0110.00420.52
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0030.00519.83
8.2.110.0030.00619.57
8.2.100.0070.00417.97
8.2.90.0000.00919.26
8.2.80.0040.00419.59
8.2.70.0040.00417.49
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0040.00418.34
8.2.30.0000.01019.71
8.2.20.0040.00417.58
8.2.10.0040.00417.62
8.2.00.0030.00717.79
8.1.280.0090.00625.92
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0000.00928.09
8.1.240.0130.00020.81
8.1.230.0060.00621.07
8.1.220.0000.00818.77
8.1.210.0030.00518.97
8.1.200.0040.00417.35
8.1.190.0000.00917.53
8.1.180.0030.00518.10
8.1.170.0080.00018.63
8.1.160.0040.00418.79
8.1.150.0050.00218.63
8.1.140.0030.00517.44
8.1.130.0000.00717.88
8.1.120.0060.00317.36
8.1.110.0040.00417.43
8.1.100.0000.00717.37
8.1.90.0020.00517.32
8.1.80.0000.00717.43
8.1.70.0030.00317.45
8.1.60.0060.00317.53
8.1.50.0040.00417.49
8.1.40.0030.00517.49
8.1.30.0040.00417.65
8.1.20.0040.00417.49
8.1.10.0040.00417.57
8.1.00.0030.00617.52
8.0.300.0070.00020.05
8.0.290.0040.00417.30
8.0.280.0000.00718.41
8.0.270.0090.00217.21
8.0.260.0030.00316.98
8.0.250.0040.00416.84
8.0.240.0040.00416.82
8.0.230.0070.00016.92
8.0.220.0000.00716.88
8.0.210.0080.00016.84
8.0.200.0030.00316.95
8.0.190.0040.00316.94
8.0.180.0050.00516.78
8.0.170.0040.00416.81
8.0.160.0070.00016.87
8.0.150.0000.00716.88
8.0.140.0070.00016.73
8.0.130.0000.00613.29
8.0.120.0000.00816.85
8.0.110.0070.00016.85
8.0.100.0040.00416.76
8.0.90.0050.00316.76
8.0.80.0060.00916.90
8.0.70.0020.00516.94
8.0.60.0040.00416.95
8.0.50.0040.00416.75
8.0.30.0120.00717.13
8.0.20.0100.01217.40
8.0.10.0000.00816.82
8.0.00.0060.01216.92
7.4.330.0030.00315.11
7.4.320.0030.00316.56
7.4.300.0040.00416.58
7.4.290.0040.00416.58
7.4.280.0080.00016.63
7.4.270.0030.00316.46
7.4.260.0030.00313.23
7.4.250.0030.00616.52
7.4.240.0000.00716.56
7.4.230.0050.00216.38
7.4.220.0100.01316.55
7.4.210.0040.01216.57
7.4.200.0030.00316.40
7.4.190.0000.00816.40
7.4.160.0050.01116.55
7.4.150.0040.01517.40
7.4.140.0090.00917.86
7.4.130.0090.00816.65
7.4.120.0070.01016.41
7.4.110.0100.01016.58
7.4.100.0100.00716.57
7.4.90.0060.01116.29
7.4.80.0080.01819.39
7.4.70.0100.00716.45
7.4.60.0040.01216.59
7.4.50.0080.00016.58
7.4.40.0140.00322.77
7.4.30.0060.01216.56
7.4.00.0060.00914.66
7.3.330.0050.00013.00
7.3.320.0000.00613.23
7.3.310.0070.00016.30
7.3.300.0070.00016.13
7.3.290.0060.01516.29
7.3.280.0120.00716.28
7.3.270.0120.00617.40
7.3.260.0100.01118.24
7.3.250.0110.01416.51
7.3.240.0130.00316.33
7.3.230.0100.00716.53
7.3.210.0130.00316.65
7.3.200.0100.00919.39
7.3.190.0150.00316.27
7.3.180.0150.00616.43
7.3.170.0100.00716.27
7.3.160.0120.00616.44
7.3.120.0040.00414.92
7.2.330.0150.00316.68
7.2.320.0100.00716.39
7.2.310.0090.00916.41
7.2.300.0060.01616.43
7.2.290.0030.01316.66
7.2.80.0000.00916.57
7.2.60.0030.01016.56
7.2.00.0030.01319.23
7.1.200.0000.01315.50
7.1.100.0030.01017.93
7.1.70.0000.01116.81
7.1.60.0110.00317.23
7.1.50.0030.00716.57
7.1.00.0030.03322.40
7.0.200.0030.01416.57
7.0.140.0030.07322.21
7.0.100.0100.07020.10
7.0.90.0330.07719.98
7.0.80.0130.04720.10
7.0.70.0170.08320.08
7.0.60.0100.08020.05
7.0.50.0100.07020.26
7.0.40.0070.08020.13
7.0.30.0170.07020.08
7.0.20.0070.05320.11
7.0.10.0030.08320.07
7.0.00.0170.04020.13
5.6.280.0070.07021.08
5.6.250.0100.07320.68
5.6.240.0100.04320.74
5.6.230.0130.03020.79
5.6.220.0100.07720.62
5.6.210.0100.07720.69
5.6.200.0130.09021.00
5.6.190.0030.04021.06
5.6.180.0030.07321.13
5.6.170.0100.05021.11
5.6.160.0130.07721.06
5.6.150.0130.06021.12
5.6.140.0130.07721.05
5.6.130.0130.08021.06
5.6.120.0070.07721.14
5.6.110.0030.07320.98
5.6.100.0030.08321.16
5.6.90.0100.07021.11
5.6.80.0070.07720.44
5.6.70.0030.04020.47
5.6.60.0100.07720.38
5.6.50.0130.07020.47
5.6.40.0170.07320.35
5.6.30.0130.02720.34
5.6.20.0030.07320.35
5.6.10.0070.03720.52
5.6.00.0230.06720.55
5.5.380.0000.07720.39
5.5.370.0030.04020.46
5.5.360.0070.07720.43
5.5.350.0030.04020.56
5.5.340.0070.08020.96
5.5.330.0030.04320.92
5.5.320.0030.05320.68
5.5.310.0200.05320.84
5.5.300.0000.05020.87
5.5.290.0070.08320.75
5.5.280.0100.06020.95
5.5.270.0100.08320.88
5.5.260.0130.07720.96
5.5.250.0070.08720.47
5.5.240.0030.05720.29
5.5.230.0070.08320.25
5.5.220.0000.04320.29
5.5.210.0000.04020.15
5.5.200.0070.07320.17
5.5.190.0070.03320.16
5.5.180.0000.04320.31
5.5.160.0070.05020.32
5.5.150.0100.08020.31
5.5.140.0030.10720.27
5.5.130.0070.05720.25
5.5.120.0000.08320.25
5.5.110.0030.07320.26
5.5.100.0030.07720.12
5.5.90.0130.06720.17
5.5.80.0070.07320.09
5.5.70.0130.04720.15
5.5.60.0000.07320.12
5.5.50.0000.08019.97
5.5.40.0000.08320.20
5.5.30.0070.08020.09
5.5.20.0070.07720.18
5.5.10.0070.06320.05
5.5.00.0130.03320.04
5.4.450.0100.04019.36
5.4.440.0130.05719.35
5.4.430.0170.06719.39
5.4.420.0070.04319.43
5.4.410.0130.07319.18
5.4.400.0030.04318.79
5.4.390.0100.07719.11
5.4.380.0070.06719.10
5.4.370.0030.07319.12
5.4.360.0070.07319.02
5.4.350.0070.03319.09
5.4.340.0030.03718.98
5.4.320.0030.03719.15
5.4.310.0000.04019.14
5.4.300.0030.06318.80
5.4.290.0030.07018.98
5.4.280.0070.06319.11
5.4.270.0070.07019.22
5.4.260.0100.07019.23
5.4.250.0070.08719.11
5.4.240.0100.06319.13
5.4.230.0100.03318.82
5.4.220.0130.05319.07
5.4.210.0030.08019.12
5.4.200.0030.08019.09
5.4.190.0070.05718.95
5.4.180.0100.05319.10
5.4.170.0030.04719.10
5.4.160.0130.06318.90
5.4.150.0100.07019.10
5.4.140.0000.04716.28
5.4.130.0070.05716.34
5.4.120.0000.07716.32
5.4.110.0000.07716.23
5.4.100.0030.04016.49
5.4.90.0000.08016.45
5.4.80.0030.07316.27
5.4.70.0030.04016.25
5.4.60.0170.06016.36
5.4.50.0170.06016.46
5.4.40.0000.04316.35
5.4.30.0030.07016.47
5.4.20.0000.03716.29
5.4.10.0070.03316.45
5.4.00.0130.06315.70
5.3.290.0000.05014.66
5.3.280.0070.05014.60
5.3.270.0070.07714.48
5.3.260.0030.03714.64
5.3.250.0030.07714.61
5.3.240.0130.06014.64
5.3.230.0030.07714.46
5.3.220.0070.04014.62
5.3.210.0070.03314.47
5.3.200.0100.07014.56
5.3.190.0030.07714.62
5.3.180.0130.07014.47
5.3.170.0000.07014.49
5.3.160.0070.04714.54
5.3.150.0070.04314.47
5.3.140.0100.07314.59
5.3.130.0030.07714.45
5.3.120.0070.06714.58
5.3.110.0170.05714.57
5.3.100.0030.06713.94
5.3.90.0070.03313.97
5.3.80.0030.05714.00
5.3.70.0030.04313.92
5.3.60.0070.08013.99
5.3.50.0070.03013.90
5.3.40.0030.04713.94
5.3.30.0000.06713.94
5.3.20.0000.03713.73
5.3.10.0100.06713.66
5.3.00.0070.07013.62

preferences:
44.48 ms | 401 KiB | 5 Q