3v4l.org

run code in 300+ PHP versions simultaneously
<?php $shuZhu=array(array("经理1","经理2"),array("主管1","主管2","经理3"),array("组长","老大")); $fontPosition='simhei.ttf'; class process { var $arr;//流程确定的数组 var $promoters;//流程发起人 var $black;//所画节点颜色 var $imgWidth;//图片宽度 var $imgHeight;//图片长度 var $font;//字体存放位置 var $fontSize; function __construct($shuZhu,$fontP,$width=400,$height=300,$fontSize=10,$promoters="") { $this->arr=$shuZhu; $this->promoters=$promoters; $this->font = $fontP; $this->imgWidth=$width; $this->imgHeight=$height; $this->fontSize=$fontSize; } //point(x1,x2)是画图的起始点,w是横线的长,h是竖线的长,r是节点圆点的半径 function show( $x,$y,$w,$h,$r) { //创建画布 $image=imagecreatetruecolor($this->imgWidth,$this->imgHeight); //设置图像中所需的颜色 $gray=imagecolorallocate($image,0xc0,0xC0,0xC0); $red=imagecolorallocate($image,0xFF,0x00,0x00); $black=imagecolorallocate($image,0x00,0x00,0x00); imagefill($image,0,0,$gray); imageline($image,$x,$y,$x+$w,$y,$red);//画第一条横线线 imagefilledellipse($image, $x,$y, $r,$r, $black);//画出发起人的节点 imagettftext($image,$this->fontSize, 0, $x-$w/4,$y+$w/2, $black, $this->font,$this->promoters); for($i=0;$i<count($this->arr);$i++) { $num=count($this->arr[$i]);//该级接点上有多少人 if($num>1)//节点上的人数多于一人,则先画一条竖线 { imageline($image,$x+$w*($i+1),$y-$h/2,$x+$w*($i+1),$y+$h/2,$red); } for($j=0;$j<count($this->arr[$i]);$j++) { if($num>1) { $m=$h/($num-1);//一个节点上有count[$arr[i]]个人,则$m代表截取竖线的长度 imageline($image,$x+$w*($i+1),$y-$h/2+$m*$j,$x+$w*($i+2),$y,$red); imagefilledellipse($image, $x+$w*($i+1),$y-$h/2+$m*$j, $r,$r, $black); //imagestring($image,2,$x+$w*($i+1)-10,$y-$h/2+$m*$j+5,$this->arr[$i][$j],$black);//直接输出接点上的人员名称 imagettftext($image, $this->fontSize, 0, $x+$w*($i+1)-$w/4,$y-$h/2+$m*$j+$w/2, $black, $this->font, $this->arr[$i][$j]); } else { imageline($image,$x+$w*($i+1),$y,$x+$w*($i+2),$y,$red);//画一条横线 imagefilledellipse($image, $x+$w*($i+1),$y, $r,$r, $black); //imagestring($image,2,$x+$w*($i+1),$y,$this->arr[$i][0],$black);//直接输出接点上的人员名称 imagettftext($image,$this->fontSize, 0, $x+$w*($i+1)-$w/4,$y+$w/2, $black, $this->font,$this->arr[$i][0]); } } } header('Content-type:image/png'); imagepng($image); imagedestroy($image); } } $img=new process($shuZhu,$fontPosition,600,300,10,"董事长"); $img->show(10,150,50,200,8); ?>

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.70.0090.00616.88
8.3.60.0040.01418.43
8.3.50.0080.01022.11
8.3.40.0190.00318.96
8.3.30.0060.01018.92
8.3.20.0040.00418.98
8.3.10.0000.00820.66
8.3.00.0030.00523.65
8.2.180.0070.01417.00
8.2.170.0040.01522.96
8.2.160.0160.00020.50
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00419.23
8.2.110.0060.00322.25
8.2.100.0120.00018.09
8.2.90.0080.00017.88
8.2.80.0060.00318.82
8.2.70.0080.00017.75
8.2.60.0030.00517.63
8.2.50.0080.00018.05
8.2.40.0060.00318.01
8.2.30.0060.00318.09
8.2.20.0000.00817.82
8.2.10.0040.00417.73
8.2.00.0040.00417.96
8.1.280.0040.01525.92
8.1.270.0000.00723.99
8.1.260.0120.00626.35
8.1.250.0040.00428.09
8.1.240.0060.00319.26
8.1.230.0080.00321.16
8.1.220.0040.00418.59
8.1.210.0000.00818.77
8.1.200.0080.00417.34
8.1.190.0000.00817.48
8.1.180.0000.00818.10
8.1.170.0060.00318.73
8.1.160.0070.00018.83
8.1.150.0080.00018.53
8.1.140.0000.00817.50
8.1.130.0000.00717.82
8.1.120.0070.00017.51
8.1.110.0000.00817.38
8.1.100.0030.00517.44
8.1.90.0000.00717.42
8.1.80.0000.00717.34
8.1.70.0000.00817.47
8.1.60.0060.00317.66
8.1.50.0030.00517.44
8.1.40.0060.00317.53
8.1.30.0050.00317.64
8.1.20.0040.00417.76
8.1.10.0040.00417.56
8.1.00.0040.00417.45
8.0.300.0040.00418.77
8.0.290.0060.00316.75
8.0.280.0000.00820.19
8.0.270.0040.00417.25
8.0.260.0070.00018.47
8.0.250.0040.00416.92
8.0.240.0000.00817.01
8.0.230.0000.00717.01
8.0.220.0030.00316.94
8.0.210.0040.00416.85
8.0.200.0050.00316.91
8.0.190.0040.00417.01
8.0.180.0000.00716.85
8.0.170.0050.00216.87
8.0.160.0070.00016.99
8.0.150.0060.00316.89
8.0.140.0070.00016.90
8.0.130.0000.00813.49
8.0.120.0030.00616.93
8.0.110.0030.00516.99
8.0.100.0040.00416.88
8.0.90.0020.00516.96
8.0.80.0000.01516.93
8.0.70.0000.00717.04
8.0.60.0040.00417.00
8.0.50.0080.00016.98
8.0.30.0150.00717.10
8.0.20.0100.01017.40
8.0.10.0040.00417.10
8.0.00.0060.01416.78
7.4.330.0000.00613.43
7.4.320.0070.00016.61
7.4.300.0030.00316.66
7.4.290.0000.00816.58
7.4.280.0060.00316.61
7.4.270.0000.00716.64
7.4.260.0030.00313.37
7.4.250.0040.00416.61
7.4.240.0000.00816.71
7.4.230.0030.00316.71
7.4.220.0150.01116.60
7.4.210.0050.01316.61
7.4.200.0040.00416.67
7.4.190.0030.00316.56
7.4.160.0150.00016.64
7.4.150.0090.00917.40
7.4.140.0060.01317.86
7.4.130.0110.00616.66
7.4.120.0130.01016.68
7.4.110.0190.00016.49
7.4.100.0040.01716.66
7.4.90.0150.00316.68
7.4.80.0100.00719.37
7.4.70.0100.00916.72
7.4.60.0070.01016.40
7.4.50.0000.00916.54
7.4.40.0070.01122.27
7.4.30.0070.01116.80
7.4.00.0040.01115.28
7.3.330.0000.00513.46
7.3.320.0060.00013.43
7.3.310.0030.00316.46
7.3.300.0000.00716.45
7.3.290.0090.00916.49
7.3.280.0100.00716.42
7.3.270.0140.00717.40
7.3.260.0160.00418.24
7.3.250.0120.00916.48
7.3.240.0160.00316.63
7.3.230.0080.00816.47
7.3.210.0140.00316.29
7.3.200.0080.00819.39
7.3.190.0060.01016.36
7.3.180.0120.00416.41
7.3.170.0070.01016.48
7.3.160.0060.00916.41
7.3.120.0070.01014.83
7.3.10.0100.00316.33
7.3.00.0040.01116.42
7.2.330.0080.00916.73
7.2.320.0090.01216.63
7.2.310.0090.00916.69
7.2.300.0090.00916.58
7.2.290.0060.01516.48
7.2.130.0000.01717.10
7.2.120.0110.00416.96
7.2.110.0030.01016.86
7.2.100.0030.01116.79
7.2.90.0040.01216.72
7.2.80.0040.00716.85
7.2.70.0040.01116.66
7.2.60.0060.00916.80
7.2.50.0030.01016.86
7.2.40.0060.00916.87
7.2.30.0060.00316.96
7.2.20.0100.00317.04
7.2.10.0030.01016.70
7.2.00.0070.00716.88
7.1.250.0100.00015.92
7.1.200.0060.01015.60
7.1.70.0000.00717.07
7.1.60.0090.00619.40
7.1.50.0030.00917.02
7.1.00.0000.04322.28
7.0.200.0060.00316.78
7.0.140.0000.07722.07
7.0.60.0070.08719.98
7.0.50.0100.04717.91
7.0.40.0070.08017.91
7.0.30.0030.04717.79
7.0.20.0070.07017.73
7.0.10.0030.07317.71
7.0.00.0170.07317.72
5.6.280.0130.06021.06
5.6.210.0070.08020.56
5.6.200.0100.05318.16
5.6.190.0030.05318.23
5.6.180.0070.08318.16
5.6.170.0000.07018.22
5.6.160.0130.07018.25
5.6.150.0070.08318.16
5.6.140.0070.07718.19
5.6.130.0000.08718.16
5.6.120.0070.07718.18
5.6.110.0100.05718.15
5.6.100.0100.07318.18
5.6.90.0070.05718.16
5.6.80.0030.04717.54
5.6.70.0070.08717.54
5.6.60.0030.05017.56
5.6.50.0100.05017.67
5.6.40.0030.07317.53
5.6.30.0030.04317.54
5.6.20.0130.04717.50
5.6.10.0030.06717.63
5.6.00.0130.06717.53
5.5.350.0130.04720.45
5.5.340.0000.06718.09
5.5.330.0070.07317.99
5.5.320.0100.04318.00
5.5.310.0070.07717.93
5.5.300.0030.06018.08
5.5.290.0170.07017.98
5.5.280.0030.04018.04
5.5.270.0030.08317.97
5.5.260.0030.08318.07
5.5.250.0130.06717.80
5.5.240.0130.07317.47
5.5.230.0030.05317.41
5.5.220.0070.07717.44
5.5.210.0030.08317.46
5.5.200.0000.08717.40
5.5.190.0070.08017.44
5.5.180.0130.07017.40
5.5.160.0070.04317.43
5.5.150.0070.05017.30
5.5.140.0130.03317.32
5.5.130.0000.04317.32
5.5.120.0130.07017.30
5.5.110.0100.04317.31
5.5.100.0130.05717.20
5.5.90.0100.06017.26
5.5.80.0130.07017.29
5.5.70.0070.07717.23
5.5.60.0100.07317.29
5.5.50.0100.06017.23
5.5.40.0070.04017.21
5.5.30.0130.07017.21
5.5.20.0070.06317.31
5.5.10.0130.07317.18
5.5.00.0070.08017.30
5.4.450.0100.07719.43
5.4.440.0070.08019.40
5.4.430.0070.04019.42
5.4.420.0030.08019.37
5.4.410.0070.05019.08
5.4.400.0070.05018.96
5.4.390.0030.06018.96
5.4.380.0030.05719.09
5.4.370.0130.06719.01
5.4.360.0030.05719.13
5.4.350.0070.04318.95
5.4.340.0070.07719.14
5.4.320.0100.03319.06
5.4.310.0170.06318.89
5.4.300.0130.07019.27
5.4.290.0030.05719.12
5.4.280.0130.07318.98
5.4.270.0100.08018.95
5.4.260.0130.07719.13
5.4.250.0070.06719.05
5.4.240.0130.07019.13
5.4.230.0070.04019.09
5.4.220.0130.07319.26
5.4.210.0070.04319.01
5.4.200.0100.07019.01
5.4.190.0000.04319.08
5.4.180.0070.03719.08
5.4.170.0030.05018.88
5.4.160.0100.05719.04
5.4.150.0000.08019.03
5.4.140.0070.07716.45
5.4.130.0130.05316.30
5.4.120.0130.06716.29
5.4.110.0170.04016.36
5.4.100.0170.05716.40
5.4.90.0170.06716.36
5.4.80.0070.04716.30
5.4.70.0070.07016.38
5.4.60.0100.04316.30
5.4.50.0030.05016.41
5.4.40.0070.06316.41
5.4.30.0030.07716.34
5.4.20.0100.04016.41
5.4.10.0100.04016.40
5.4.00.0100.03715.82
5.3.290.0000.05014.76
5.3.280.0070.07714.68
5.3.270.0100.03714.49
5.3.260.0070.07714.74
5.3.250.0030.07714.64
5.3.240.0100.04314.70
5.3.230.0000.08314.68
5.3.220.0130.07314.66
5.3.210.0070.06314.64
5.3.200.0170.05314.66
5.3.190.0070.04714.56
5.3.180.0100.07314.82
5.3.170.0070.07714.60
5.3.160.0100.07314.56
5.3.150.0130.07014.70
5.3.140.0100.07714.54
5.3.130.0170.07314.68
5.3.120.0100.06714.54
5.3.110.0070.04714.61
5.3.100.0030.06714.14
5.3.90.0130.05014.11
5.3.80.0100.07014.05
5.3.70.0100.04013.89
5.3.60.0030.04014.09
5.3.50.0130.06714.08
5.3.40.0100.04714.03
5.3.30.0130.05713.84
5.3.20.0030.06713.83
5.3.10.0100.07013.67
5.3.00.0130.05713.71
5.2.170.0000.04711.25
5.2.160.0170.05011.14
5.2.150.0000.04011.39
5.2.140.0000.05711.23
5.2.130.0030.03011.18
5.2.120.0030.03711.14
5.2.110.0030.05011.18
5.2.100.0170.04311.13
5.2.90.0070.04311.20
5.2.80.0100.05711.22
5.2.70.0070.03711.14
5.2.60.0030.05011.13
5.2.50.0070.03311.04
5.2.40.0000.03011.02
5.2.30.0000.03311.06
5.2.20.0000.03011.00
5.2.10.0000.03310.89
5.2.00.0030.02710.78
5.1.60.0000.02710.24
5.1.50.0030.02310.24
5.1.40.0030.0239.85
5.1.30.0000.02710.32
5.1.20.0030.02310.43
5.1.10.0000.02710.03
5.1.00.0000.02710.32
5.0.50.0000.0238.73
5.0.40.0030.0178.54
5.0.30.0000.0438.28
5.0.20.0030.0178.34
5.0.10.0030.0208.25
5.0.00.0000.0308.23
4.4.90.0070.0277.90
4.4.80.0030.0207.90
4.4.70.0000.0177.90
4.4.60.0000.0177.90
4.4.50.0030.0137.90
4.4.40.0030.0237.90
4.4.30.0030.0137.90
4.4.20.0000.0177.90
4.4.10.0030.0137.90
4.4.00.0000.0237.90
4.3.110.0000.0137.90
4.3.100.0000.0177.90
4.3.90.0000.0177.90
4.3.80.0000.0277.90
4.3.70.0000.0137.90
4.3.60.0000.0137.90
4.3.50.0000.0177.90
4.3.40.0000.0237.90
4.3.30.0000.0137.90
4.3.20.0000.0137.90
4.3.10.0000.0177.90
4.3.00.0000.0137.90

preferences:
47.19 ms | 401 KiB | 5 Q