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 = 10; $mouseX = 200; $mouseY = 200; $point = new Point(300, 300); $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)/$moves; $lineWidthDiv = 0; foreach ( $angles as $angle ) { $lineWidthDiv += cos($angle*pi()/180); } $lineWidth = ($point->X - $mouseX)/$moves; $points = array(new Point($mouseX, $mouseY)); for ( $i=1; $i<=$moves; $i++ ) { $x = $points[$i-1]->X + $lineWidth; $y = $points[$i-1]->Y + $lineHeight; $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.3.120.0090.00915.08
7.3.110.0030.01614.69
7.3.100.0100.00715.30
7.3.90.0100.00615.16
7.3.80.0030.01215.20
7.3.70.0060.00914.82
7.3.60.0080.00815.31
7.3.50.0060.00915.33
7.3.40.0030.00715.02
7.3.30.0060.00915.21
7.3.20.0030.00717.06
7.3.10.0070.01016.97
7.3.00.0130.00317.11
7.2.240.0110.00715.42
7.2.230.0070.01315.38
7.2.220.0100.00315.68
7.2.210.0070.01015.22
7.2.200.0090.00915.01
7.2.190.0040.01115.47
7.2.180.0060.00615.05
7.2.170.0080.00815.39
7.2.160.0090.00915.54
7.2.150.0090.00917.32
7.2.140.0060.00817.25
7.2.130.0000.01017.43
7.2.120.0110.00416.93
7.2.110.0070.00717.10
7.2.100.0050.00416.96
7.2.90.0060.00917.10
7.2.80.0120.00617.09
7.2.70.0030.00917.07
7.2.60.0000.01217.09
7.2.50.0040.01217.23
7.2.40.0000.01416.91
7.2.30.0040.00817.38
7.2.20.0160.00017.22
7.2.10.0000.01216.98
7.2.00.0060.00618.36
7.1.330.0110.00716.03
7.1.320.0030.01016.29
7.1.310.0060.00615.89
7.1.300.0000.01216.01
7.1.290.0120.00415.78
7.1.280.0080.00816.05
7.1.270.0030.00616.24
7.1.260.0040.01215.82
7.1.250.0030.00716.14
7.1.70.0000.01017.54
7.1.60.0180.00719.46
7.1.50.0170.00717.22
7.1.00.0070.07322.62
7.0.200.0000.00817.27
7.0.140.0070.07022.23
7.0.110.0500.07722.02
7.0.100.0070.08022.01
7.0.90.0130.07022.00
7.0.80.0030.09021.98
7.0.70.0070.08321.88
7.0.60.0100.08022.07
7.0.50.0030.07722.33
7.0.40.0070.09020.20
7.0.30.0030.08720.21
7.0.20.0100.08320.35
7.0.10.0070.07720.41
7.0.00.0030.09020.25
5.6.280.0000.07721.15
5.6.260.0100.04720.87
5.6.250.0030.06720.87
5.6.240.0170.07320.75
5.6.230.0070.07720.79
5.6.220.0170.08020.82
5.6.210.0170.07720.80
5.6.200.0070.06321.30
5.6.190.0170.06721.37
5.6.180.0170.07021.23
5.6.170.0070.08321.38
5.6.160.0030.08321.18
5.6.150.0070.08021.21
5.6.140.0070.07721.37
5.6.130.0070.09021.17
5.6.120.0100.09021.17
5.6.110.0200.07021.25
5.6.100.0100.07721.22
5.6.90.0070.08321.18
5.6.80.0100.07720.88
5.6.70.0030.07720.83
5.6.60.0100.07320.82
5.6.50.0070.07320.56
5.6.40.0030.08020.76
5.6.30.0070.08020.64
5.6.20.0000.05020.83
5.6.10.0100.07020.57
5.6.00.0070.08020.52
5.5.380.0200.06720.70
5.5.370.0100.05720.78
5.5.360.0070.07020.59
5.5.350.0030.08020.56
5.5.340.0130.07721.07
5.5.330.0070.08321.03
5.5.320.0030.08721.01
5.5.310.0030.08021.08
5.5.300.0070.07721.09
5.5.290.0030.08321.20
5.5.280.0070.08721.08
5.5.270.0000.08720.98
5.5.260.0030.05321.05
5.5.250.0030.06020.64
5.5.240.0030.07320.45
5.5.230.0100.08320.47
5.5.220.0100.07720.54
5.5.210.0100.06020.47
5.5.200.0070.08020.35
5.5.190.0070.07720.52
5.5.180.0100.07720.45
5.5.160.0170.06720.48
5.5.150.0130.07720.34
5.5.140.0000.08320.52
5.5.130.0130.07320.53
5.5.120.0070.06320.43
5.5.110.0100.07020.50
5.5.100.0070.08020.45
5.5.90.0000.07720.34
5.5.80.0130.04320.29
5.5.70.0000.08020.43
5.5.60.0070.06720.38
5.5.50.0070.07020.43
5.5.40.0000.07720.36
5.5.30.0000.07720.37
5.5.20.0100.06720.15
5.5.10.0130.06320.21
5.5.00.0130.06320.39
5.4.450.0070.07719.46
5.4.440.0000.09319.58
5.4.430.0070.07319.60
5.4.420.0170.07019.58
5.4.410.0030.08019.53
5.4.400.0070.07319.20
5.4.390.0100.07719.63
5.4.380.0030.07719.14
5.4.370.0030.08019.26
5.4.360.0030.06319.24
5.4.350.0100.06019.07
5.4.340.0030.04319.32
5.4.320.0100.07719.20
5.4.310.0030.07019.26
5.4.300.0000.08719.28
5.4.290.0070.07719.20
5.4.280.0100.07319.37
5.4.270.0170.06719.25
5.4.260.0130.07019.35
5.4.250.0170.05719.23
5.4.240.0070.08019.27
5.4.230.0030.08019.53
5.4.220.0100.06719.07
5.4.210.0130.07019.20
5.4.200.0030.07719.27
5.4.190.0100.07319.23
5.4.180.0070.06719.36
5.4.170.0100.07719.34
5.4.160.0070.07319.18
5.4.150.0130.07019.41
5.4.140.0100.07016.55
5.4.130.0000.07716.67
5.4.120.0030.08016.54
5.4.110.0070.07316.90
5.4.100.0030.07716.75
5.4.90.0000.08016.62
5.4.80.0030.07016.44
5.4.70.0000.08016.76
5.4.60.0100.06016.66
5.4.50.0130.06716.75
5.4.40.0000.07716.92
5.4.30.0100.06016.79
5.4.20.0070.06716.72
5.4.10.0070.07316.76
5.4.00.0070.07716.05
5.3.290.0170.06714.97
5.3.280.0000.04014.72
5.3.270.0130.07014.94
5.3.260.0030.08014.82
5.3.250.0200.06714.98
5.3.240.0000.08014.77
5.3.230.0030.07314.79
5.3.220.0070.07014.73
5.3.210.0030.07315.00
5.3.200.0030.04314.86
5.3.190.0100.07714.93
5.3.180.0030.06315.00
5.3.170.0130.06714.79
5.3.160.0100.07014.86
5.3.150.0100.05315.00
5.3.140.0100.04314.62
5.3.130.0030.05014.91
5.3.120.0030.08014.89
5.3.110.0130.04714.71
5.3.100.0000.05014.23
5.3.90.0030.07314.36
5.3.80.0070.08014.35
5.3.70.0070.07014.23
5.3.60.0030.07314.20
5.3.50.0070.06314.13
5.3.40.0070.05014.30
5.3.30.0100.06714.21
5.3.20.0170.06013.88
5.3.10.0130.06313.85
5.3.00.0070.06713.98
5.2.170.0030.06011.56
5.2.160.0070.06011.56
5.2.150.0030.06311.56
5.2.140.0030.04011.56
5.2.130.0070.05711.56
5.2.120.0100.05711.56
5.2.110.0030.07011.56
5.2.100.0100.05711.56
5.2.90.0070.05711.56
5.2.80.0070.04311.56
5.2.70.0070.05711.56
5.2.60.0070.03311.56
5.2.50.0070.05711.56
5.2.40.0070.06311.56
5.2.30.0000.06711.56
5.2.20.0000.06011.56
5.2.10.0030.05711.56
5.2.00.0100.05011.56
5.1.60.0000.05311.56
5.1.50.0070.04011.56
5.1.40.0000.04311.56
5.1.30.0100.05311.56
5.1.20.0030.06011.56
5.1.10.0030.05711.56
5.1.00.0000.05311.56
5.0.50.0070.04311.56
5.0.40.0030.04011.56
5.0.30.0000.05711.56
5.0.20.0000.03711.56
5.0.10.0030.04311.56
5.0.00.0070.06311.56
4.4.90.0000.03311.56
4.4.80.0030.03311.56
4.4.70.0030.03311.56
4.4.60.0030.01711.56
4.4.50.0030.01711.56
4.4.40.0070.04711.56
4.4.30.0000.01711.56
4.4.20.0000.03711.56
4.4.10.0000.03311.56
4.4.00.0000.04711.56
4.3.110.0030.01711.56
4.3.100.0000.03711.56
4.3.90.0030.01711.56
4.3.80.0030.04311.56
4.3.70.0000.03311.56
4.3.60.0030.03011.56
4.3.50.0000.01711.56
4.3.40.0000.05311.56
4.3.30.0070.02711.56
4.3.20.0000.02311.56
4.3.10.0000.03311.56
4.3.00.0070.03011.56

preferences:
35.04 ms | 400 KiB | 5 Q