3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Point { public $X; public $Y; function __construct($X, $Y) { $this->X = $X; $this->Y = $Y; } } $moves = 4; $mouseX = 0; $mouseY = 0; $point = new Point(400, 400); //$startAngle = rand(0, 90); $startAngle = 30; echo 'Angle = '.$startAngle."\r\n"; $angles = array($startAngle); for ( $i=1; $i<$moves; $i++ ) { $angles[$i] = $angles[$i-1] + (90 - 2*$startAngle)/($moves-1); } $lineHeightDiv = 0; foreach ( $angles as $angle ) { $lineHeightDiv += sin($angle*pi()/180); } $lineHeight = (($point->Y-$mouseY)/$lineHeightDiv)/$moves; echo 'LineHeight = '.$lineHeight."\r\n"; $lineWidthDiv = 0; foreach ( $angles as $angle ) { $lineWidthDiv += cos($angle*pi()/180); } $lineWidth = (($point->X-$mouseX)/$lineWidthDiv)/$moves; echo 'LineWidth = '.$lineWidth."\r\n"; $points = array(new Point($mouseX, $mouseY)); for ( $i=1; $i<=$moves; $i++ ) { $x = $points[$i-1]->X + $lineWidth*cos($angles[$i]*pi()/180); $y = $points[$i-1]->Y + $lineHeight*sin($angles[$i]*pi()/180); $points[] = new Point($x, $y); } var_dump($points);

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.0120.00317.00
8.3.50.0100.00822.29
8.3.40.0090.00619.23
8.3.30.0070.00719.46
8.3.20.0000.00720.68
8.3.10.0040.00423.89
8.3.00.0080.00019.88
8.2.180.0080.00819.04
8.2.170.0100.00622.96
8.2.160.0030.01020.77
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0110.00026.16
8.2.120.0080.00022.46
8.2.110.0070.01122.50
8.2.100.0090.00318.22
8.2.90.0080.00019.68
8.2.80.0050.00318.41
8.2.70.0060.00318.00
8.2.60.0040.00418.43
8.2.50.0070.00318.07
8.2.40.0060.00318.41
8.2.30.0040.00418.44
8.2.20.0000.00818.19
8.2.10.0100.00020.22
8.2.00.0000.01118.14
8.1.280.0130.00325.92
8.1.270.0090.00022.47
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00624.13
8.1.230.0040.00722.32
8.1.220.0040.00417.90
8.1.210.0000.00818.77
8.1.200.0030.00617.72
8.1.190.0090.00017.78
8.1.180.0030.00619.04
8.1.170.0030.00618.89
8.1.160.0000.00822.23
8.1.150.0040.00419.02
8.1.140.0080.00017.83
8.1.130.0000.00718.13
8.1.120.0000.00817.77
8.1.110.0070.00017.79
8.1.100.0040.00417.73
8.1.90.0050.00217.67
8.1.80.0040.00417.72
8.1.70.0030.00517.77
8.1.60.0040.00417.80
8.1.50.0030.00617.93
8.1.40.0030.00617.89
8.1.30.0000.00817.89
8.1.20.0000.00817.85
8.1.10.0030.00617.80
8.1.00.0090.00017.85
8.0.300.0040.00418.77
8.0.290.0080.00017.55
8.0.280.0040.00418.83
8.0.270.0070.00017.66
8.0.260.0030.00517.52
8.0.250.0040.00417.24
8.0.240.0070.00317.26
8.0.230.0000.00717.25
8.0.220.0070.00017.27
8.0.210.0030.00317.19
8.0.200.0060.00017.36
8.0.190.0040.00417.23
8.0.180.0050.00317.20
8.0.170.0030.00517.36
8.0.160.0030.00517.32
8.0.150.0090.00017.10
8.0.140.0100.00017.27
8.0.130.0000.00813.66
8.0.120.0040.00417.12
8.0.110.0040.00417.33
8.0.100.0050.00317.30
8.0.90.0030.00517.20
8.0.80.0130.00617.23
8.0.70.0070.00017.21
8.0.60.0030.00617.25
8.0.50.0000.00717.19
8.0.30.0100.01017.40
8.0.20.0160.00317.47
8.0.10.0000.00817.43
8.0.00.0120.00816.96
7.4.330.0050.00015.00
7.4.320.0000.00716.86
7.4.300.0000.00616.85
7.4.290.0000.00716.87
7.4.280.0000.00716.78
7.4.270.0000.00716.84
7.4.260.0030.00316.85
7.4.250.0000.00716.86
7.4.240.0020.00516.90
7.4.230.0070.00017.03
7.4.220.0130.01316.84
7.4.210.0100.00816.84
7.4.200.0070.00016.93
7.4.190.0030.00316.70
7.4.160.0140.00316.73
7.4.150.0090.00917.40
7.4.140.0120.00717.86
7.4.130.0130.00516.66
7.4.120.0090.01416.73
7.4.110.0200.00616.68
7.4.100.0160.00616.82
7.4.90.0090.00916.74
7.4.80.0100.01019.39
7.4.70.0130.00316.75
7.4.60.0110.00516.81
7.4.50.0000.00817.01
7.4.40.0050.00522.77
7.4.30.0090.00916.96
7.4.00.0070.01115.36
7.3.330.0050.00013.73
7.3.320.0000.00513.53
7.3.310.0040.00416.75
7.3.300.0000.00716.80
7.3.290.0090.00616.69
7.3.280.0100.00816.64
7.3.270.0130.01017.40
7.3.260.0180.00616.91
7.3.250.0100.01316.73
7.3.240.0080.01116.64
7.3.230.0070.01016.67
7.3.210.0150.00316.68
7.3.200.0150.00719.39
7.3.190.0120.00616.73
7.3.180.0080.00816.69
7.3.170.0100.00616.84
7.3.160.0150.00316.85
7.3.120.0030.01415.39
7.2.330.0090.00916.81
7.2.320.0130.00716.98
7.2.310.0000.01916.92
7.2.300.0070.01117.02
7.2.290.0100.00817.01
7.2.80.0070.00416.73
7.2.60.0130.00317.23
7.2.00.0000.01319.71
7.1.200.0070.00715.82
7.1.100.0030.00918.52
7.1.70.0040.01117.38
7.1.60.0070.01419.46
7.1.50.0070.01717.20
7.1.00.0030.07722.82
7.0.200.0000.00817.03
7.0.140.0030.07322.25
7.0.60.0100.07020.19
7.0.50.0070.08318.23
7.0.40.0030.09020.39
7.0.30.0200.04320.31
7.0.20.0100.05320.42
7.0.10.0030.07720.44
7.0.00.0070.05020.30
5.6.280.0030.07321.35
5.6.210.0130.06720.84
5.6.200.0030.04318.46
5.6.190.0030.08320.51
5.6.180.0370.07720.64
5.6.170.0270.07720.89
5.6.160.0070.05720.68
5.6.150.0070.08018.27
5.6.140.0130.03018.35
5.6.130.0170.05718.48
5.6.120.0100.08021.23
5.6.110.0270.06721.35
5.6.100.0130.07321.31
5.6.90.0030.06021.33
5.6.80.0070.03320.71
5.6.70.4000.04720.61
5.5.350.0100.07720.64
5.5.340.0030.04018.04
5.5.330.0130.06720.56
5.5.320.0130.08720.46
5.5.310.0330.07320.46
5.5.300.0100.07318.20
5.5.290.0070.06718.25
5.5.280.0070.06321.01
5.5.270.0070.03721.00
5.5.260.0070.08720.89
5.5.250.0070.08020.80
5.5.240.0300.07320.49
5.4.450.0730.06019.40
5.4.440.0100.06719.60
5.4.430.0270.06319.39
5.4.420.0330.04319.58
5.4.410.0170.05319.46
5.4.400.0130.06319.27
5.4.390.0170.06019.46
5.4.380.0270.05318.95
5.4.370.0200.06018.89
5.4.360.0230.05018.85
5.4.350.0170.06018.76
5.4.340.0300.04718.73
5.4.320.0050.05012.55
5.4.310.0070.03712.55
5.4.300.0050.03812.55
5.4.290.0040.04412.55
5.4.280.0130.04412.41
5.4.270.0080.03912.42
5.4.260.0050.04112.42
5.4.250.0070.04112.41
5.4.240.0100.04912.42
5.4.230.0080.05312.41
5.4.220.0090.04512.41
5.4.210.0090.04612.40
5.4.200.0120.03512.41
5.4.190.0160.09412.40
5.4.180.0150.09412.40
5.4.170.0220.10112.42
5.4.160.0100.03912.41
5.4.150.0100.03712.41
5.4.140.0070.04312.09
5.4.130.0080.03912.08
5.4.120.0070.04012.03
5.4.110.0130.06212.03
5.4.100.0150.08512.03
5.4.90.0180.05012.04
5.4.80.0110.06512.03
5.4.70.0140.07312.02
5.4.60.0090.04112.03
5.4.50.0060.04512.03
5.4.40.0060.03712.02
5.4.30.0070.05112.02
5.4.20.0050.05512.02
5.4.10.0070.05412.02
5.4.00.0050.04211.50
5.3.290.0070.03912.80
5.3.280.0080.03912.71
5.3.270.0100.04012.72
5.3.260.0100.03912.72
5.3.250.0130.05212.72
5.3.240.0120.05812.72
5.3.230.0100.03512.71
5.3.220.0120.04512.68
5.3.210.0080.04312.68
5.3.200.0070.04012.68
5.3.190.0080.03812.68
5.3.180.0090.03612.68
5.3.170.0100.03612.68
5.3.160.0090.05012.68
5.3.150.0090.05312.68
5.3.140.0120.04312.67
5.3.130.0100.04212.66
5.3.120.0070.04212.66
5.3.110.0080.05612.66
5.3.100.0130.04912.15
5.3.90.0110.05412.13
5.3.80.0110.05212.12
5.3.70.0130.04712.12
5.3.60.0120.05012.11
5.3.50.0130.04612.05
5.3.40.0120.04312.05
5.3.30.0070.05012.01
5.3.20.0140.04411.79
5.3.10.0090.04611.75
5.3.00.0060.05211.75
5.2.170.0100.0389.24
5.2.160.0100.0399.24
5.2.150.0080.0429.24
5.2.140.0070.0439.23
5.2.130.0090.0389.20
5.2.120.0070.0429.20
5.2.110.0060.0439.20
5.2.100.0120.0349.21
5.2.90.0080.0339.20
5.2.80.0070.0359.20
5.2.70.0080.0359.20
5.2.60.0110.0419.16
5.2.50.0110.0369.13
5.2.40.0110.0379.10
5.2.30.0080.0439.08
5.2.20.0110.0409.06
5.2.10.0090.0369.00
5.2.00.0080.0408.86
5.1.60.0080.0358.14
5.1.50.0080.0338.14
5.1.40.0080.0318.12
5.1.30.0070.0308.47
5.1.20.0110.0378.50
5.1.10.0080.0408.22
5.1.00.0110.0298.22
5.0.50.0070.0246.70
5.0.40.0130.0226.57
5.0.30.0060.0376.38
5.0.20.0120.0336.34
5.0.10.0150.0726.32
5.0.00.0070.0496.32
4.4.90.0050.0234.78
4.4.80.0050.0234.75
4.4.70.0060.0234.76
4.4.60.0100.0404.75
4.4.50.0160.0524.77
4.4.40.0040.0394.71
4.4.30.0100.0214.76
4.4.20.0060.0254.85
4.4.10.0070.0214.85
4.4.00.0040.0324.76
4.3.110.0070.0204.66
4.3.100.0030.0264.66
4.3.90.0040.0214.63
4.3.80.0050.0334.59
4.3.70.0100.0154.63
4.3.60.0030.0214.63
4.3.50.0040.0234.63
4.3.40.0040.0314.54
4.3.30.0050.0213.29
4.3.20.0020.0213.26
4.3.10.0030.0183.23
4.3.00.0130.02710.30

preferences:
56.39 ms | 401 KiB | 5 Q