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); 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]); $y = $points[$i-1]->Y + $lineHeight*sin($angles[$i]); $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)
7.4.00.0070.01315.29
7.3.120.0100.01015.36
7.3.110.0100.00715.15
7.3.100.0040.01115.29
7.3.90.0130.00315.33
7.3.80.0100.00715.20
7.3.70.0060.00615.28
7.3.60.0100.00715.01
7.3.50.0030.01215.10
7.3.40.0070.00715.22
7.3.30.0110.00415.20
7.3.20.0070.01117.08
7.3.10.0070.01116.89
7.3.00.0090.00616.95
7.2.250.0090.01215.62
7.2.240.0130.00315.52
7.2.230.0000.01815.51
7.2.220.0030.00715.58
7.2.210.0040.01515.39
7.2.200.0030.00915.45
7.2.190.0090.00615.30
7.2.180.0100.00715.28
7.2.170.0040.01415.34
7.2.00.0050.00819.16
7.1.330.0120.00315.97
7.1.320.0030.01016.13
7.1.310.0060.01016.09
7.1.300.0090.00616.20
7.1.290.0040.01116.13
7.1.280.0040.01516.25
7.1.270.0040.01116.06
7.1.260.0090.00616.14
7.1.70.0070.00717.53
7.1.60.0040.01519.46
7.1.50.0030.02117.35
7.1.00.0000.08022.63
7.0.200.0000.00717.22
7.0.140.0000.07722.18
7.0.60.0200.07720.25
7.0.50.0130.06318.02
7.0.40.0070.06720.31
7.0.30.0230.07720.32
7.0.20.0200.04320.41
7.0.10.0230.05020.31
7.0.00.0170.07020.40
5.6.280.0000.07721.43
5.6.210.0130.08020.86
5.6.200.0130.08018.41
5.6.190.0030.06320.79
5.6.180.0400.07320.82
5.6.170.0230.05320.70
5.6.160.0030.05020.71
5.6.150.0070.08318.53
5.6.140.0100.03718.41
5.6.130.0100.03718.45
5.6.120.0200.06721.31
5.6.110.0030.04321.26
5.6.100.0070.05021.18
5.6.90.0030.04021.40
5.6.80.0070.08320.71
5.6.70.0400.07020.67
5.5.350.0170.07720.64
5.5.340.0000.06318.27
5.5.330.0130.07320.56
5.5.320.0400.07020.45
5.5.310.0200.04720.53
5.5.300.0030.05318.24
5.5.290.0070.08018.25
5.5.280.0130.07721.19
5.5.270.0200.06021.16
5.5.260.0100.08321.10
5.5.250.0130.05720.88
5.5.240.0100.07720.31
5.4.450.0800.07019.67
5.4.440.0270.05019.86
5.4.430.0270.05319.94
5.4.420.0200.05719.73
5.4.410.0300.04719.30
5.4.400.0230.06019.54
5.4.390.0330.06019.53
5.4.380.0270.05319.02
5.4.370.0300.04718.82
5.4.360.0230.05018.93
5.4.350.0170.06719.11
5.4.340.0270.04718.77
5.4.320.0050.04112.57
5.4.310.0070.04812.56
5.4.300.0070.04112.57
5.4.290.0020.04212.56
5.4.280.0100.05512.43
5.4.270.0110.05612.42
5.4.260.0100.05812.45
5.4.250.0080.05412.43
5.4.240.0100.05312.43
5.4.230.0200.07912.43
5.4.220.0110.05212.42
5.4.210.0090.05512.42
5.4.200.0110.05112.42
5.4.190.0110.05012.41
5.4.180.0120.05112.42
5.4.170.0110.05712.43
5.4.160.0140.05512.42
5.4.150.0050.05612.42
5.4.140.0120.05712.11
5.4.130.0090.05312.10
5.4.120.0090.05612.05
5.4.110.0410.10512.05
5.4.100.0290.06512.04
5.4.90.0130.05112.05
5.4.80.0120.05312.05
5.4.70.0090.05212.04
5.4.60.0160.04912.04
5.4.50.0150.05212.04
5.4.40.0120.05012.02
5.4.30.0120.04712.02
5.4.20.0110.05112.05
5.4.10.0080.05312.02
5.4.00.0070.05311.52
5.3.290.0070.04512.82
5.3.280.0130.04912.72
5.3.270.0110.05312.73
5.3.260.0100.05612.73
5.3.250.0100.05412.73
5.3.240.0130.05212.73
5.3.230.0160.04512.75
5.3.220.0130.05112.70
5.3.210.0120.05312.69
5.3.200.0080.05212.70
5.3.190.0100.04912.70
5.3.180.0050.05512.69
5.3.170.0090.05412.69
5.3.160.0090.05212.69
5.3.150.0100.05512.70
5.3.140.0130.05112.68
5.3.130.0090.04212.68
5.3.120.0080.04312.68
5.3.110.0090.04612.68
5.3.100.0130.06012.16
5.3.90.0090.03712.14
5.3.80.0170.07412.13
5.3.70.0130.04412.13
5.3.60.0080.04112.11
5.3.50.0080.05212.05
5.3.40.0250.06412.06
5.3.30.0120.06912.02
5.3.20.0140.04811.80
5.3.10.0140.06711.77
5.3.00.0180.07211.76
5.2.170.0100.0369.26
5.2.160.0110.0339.25
5.2.150.0080.0479.26
5.2.140.0080.0469.25
5.2.130.0080.0429.21
5.2.120.0050.0309.21
5.2.110.0080.0309.21
5.2.100.0110.0559.22
5.2.90.0130.0389.21
5.2.80.0100.0419.21
5.2.70.0080.0319.21
5.2.60.0090.0319.16
5.2.50.0100.0299.14
5.2.40.0090.0519.11
5.2.30.0070.0319.09
5.2.20.0070.0339.07
5.2.10.0080.0329.01
5.2.00.0070.0348.88
5.1.60.0080.0398.15
5.1.50.0200.0578.15
5.1.40.0240.0598.14
5.1.30.0100.0558.48
5.1.20.0200.0508.50
5.1.10.0050.0298.23
5.1.00.0080.0258.23
5.0.50.0030.0266.71
5.0.40.0020.0286.58
5.0.30.0050.0356.39
5.0.20.0030.0216.36
5.0.10.0030.0226.34
5.0.00.0010.0346.32
4.4.90.0020.0174.78
4.4.80.0040.0154.75
4.4.70.0030.0174.75
4.4.60.0020.0254.76
4.4.50.0030.0234.77
4.4.40.0050.0334.71
4.4.30.0040.0394.76
4.4.20.0050.0214.84
4.4.10.0040.0214.85
4.4.00.0040.0314.75
4.3.110.0030.0224.66
4.3.100.0050.0194.67
4.3.90.0030.0204.63
4.3.80.0020.0324.58
4.3.70.0070.0284.63
4.3.60.0040.0224.63
4.3.50.0030.0234.63
4.3.40.0050.0334.54
4.3.30.0020.0223.28
4.3.20.0050.0553.26
4.3.10.0020.0203.23
4.3.00.0070.03310.30

preferences:
37.89 ms | 400 KiB | 5 Q