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; echo 'LineHeight = '.$lineHeight."\r\n"; $lineWidthDiv = 0; foreach ( $angles as $angle ) { $lineWidthDiv += cos($angle*pi()/180); } $lineWidth = ($point->X - $mouseX)/$moves; echo 'LineWidth = '.$lineWidth."\r\n"; $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.10.0050.01017.02
7.3.00.0040.01116.90
7.2.130.0080.00617.09
7.2.120.0050.01017.13
7.2.110.0070.00717.04
7.2.100.0050.00817.30
7.2.90.0050.00917.33
7.2.80.0050.01017.30
7.2.70.0120.00417.39
7.2.60.0050.00917.24
7.2.50.0060.01017.29
7.2.40.0060.00817.16
7.2.30.0050.00717.24
7.2.20.0090.00517.21
7.2.10.0130.00217.35
7.2.00.0090.00717.81
7.1.250.0050.00816.09
7.1.70.0030.00517.40
7.1.60.0060.01919.46
7.1.50.0070.01117.15
7.1.00.0000.08022.65
7.0.200.0050.00217.05
7.0.140.0030.07322.22
7.0.60.0200.07020.15
7.0.50.0070.07718.10
7.0.40.0170.07720.50
7.0.30.0270.08320.46
7.0.20.0300.04720.32
7.0.10.0270.08020.25
7.0.00.0070.09020.48
5.6.280.0100.07021.14
5.6.210.0070.06321.00
5.6.200.0070.07318.25
5.6.190.0100.04020.52
5.6.180.0400.07320.61
5.6.170.0200.04320.75
5.6.160.0100.08720.73
5.6.150.0030.08718.48
5.6.140.0170.06718.49
5.6.130.0170.06718.42
5.6.120.0070.07021.19
5.6.110.0070.04021.28
5.6.100.0100.07321.32
5.6.90.0100.08021.34
5.6.80.0100.07720.70
5.6.70.0230.08020.64
5.5.350.0170.07720.85
5.5.340.0030.04018.21
5.5.330.0070.04320.65
5.5.320.0230.04720.57
5.5.310.0270.07020.48
5.5.300.0070.07318.18
5.5.290.0070.08718.07
5.5.280.0100.08021.01
5.5.270.0330.03721.27
5.5.260.0170.07321.04
5.5.250.0070.07320.95
5.5.240.0070.08020.40
5.4.450.0700.07019.78
5.4.440.0270.07319.57
5.4.430.0300.06019.83
5.4.420.0330.05719.77
5.4.410.0300.07719.64
5.4.400.0200.05719.26
5.4.390.0270.07319.33
5.4.380.0230.06018.78
5.4.370.0200.04718.95
5.4.360.0370.04718.72
5.4.350.0300.05318.66
5.4.340.0270.06018.90
5.4.320.0090.03812.55
5.4.310.0060.04612.55
5.4.300.0060.03712.55
5.4.290.0070.03812.54
5.4.280.0150.07912.41
5.4.270.0170.05312.41
5.4.260.0090.04212.41
5.4.250.0090.05112.41
5.4.240.0250.06212.41
5.4.230.0130.06112.40
5.4.220.0130.06612.40
5.4.210.0130.05512.40
5.4.200.0160.07012.41
5.4.190.0070.05912.41
5.4.180.0260.08412.40
5.4.170.0070.04212.42
5.4.160.0080.03912.41
5.4.150.0080.03812.41
5.4.140.0060.04212.10
5.4.130.0250.05212.07
5.4.120.0210.05212.04
5.4.110.0220.06412.02
5.4.100.0170.04812.04
5.4.90.0130.07412.03
5.4.80.0070.04312.03
5.4.70.0120.04112.04
5.4.60.0140.03212.04
5.4.50.0090.03712.02
5.4.40.0140.03112.02
5.4.30.0140.04512.01
5.4.20.0100.03712.02
5.4.10.0070.03912.01
5.4.00.0100.04311.51
5.3.290.0050.04012.80
5.3.280.0100.04112.71
5.3.270.0040.04812.72
5.3.260.0050.04712.72
5.3.250.0100.04712.72
5.3.240.0090.04812.72
5.3.230.0070.04212.71
5.3.220.0160.05412.69
5.3.210.0140.04812.68
5.3.200.0080.05712.68
5.3.190.0180.07712.68
5.3.180.0240.06712.68
5.3.170.0130.06312.68
5.3.160.0200.07812.68
5.3.150.0150.07112.67
5.3.140.0260.07212.66
5.3.130.0220.08112.66
5.3.120.0140.05612.67
5.3.110.0210.06512.66
5.3.100.0160.05012.14
5.3.90.0060.06712.13
5.3.80.0130.05112.11
5.3.70.0180.07612.12
5.3.60.0170.05312.11
5.3.50.0140.05212.05
5.3.40.0340.11112.05
5.3.30.0130.04312.00
5.3.20.0110.03511.79
5.3.10.0160.05311.75
5.3.00.0110.03911.74
5.2.170.0160.0339.24
5.2.160.0100.0499.24
5.2.150.0200.0729.24
5.2.140.0130.0329.27
5.2.130.0120.0339.20
5.2.120.0140.0329.19
5.2.110.0130.0469.20
5.2.100.0190.0729.21
5.2.90.0180.0559.21
5.2.80.0090.0549.20
5.2.70.0150.0569.19
5.2.60.0180.0499.16
5.2.50.0110.0459.13
5.2.40.0060.0449.12
5.2.30.0130.0549.07
5.2.20.0140.0509.05
5.2.10.0160.0848.98
5.2.00.0130.0678.85
5.1.60.0080.0408.12
5.1.50.0180.0478.11
5.1.40.0130.0528.10
5.1.30.0130.0708.44
5.1.20.0110.0638.46
5.1.10.0100.0608.19
5.1.00.0100.0498.19
5.0.50.0110.0216.68
5.0.40.0080.0276.55
5.0.30.0080.0576.36
5.0.20.0090.0256.32
5.0.10.0060.0296.30
5.0.00.0080.0346.29
4.4.90.0040.0244.78
4.4.80.0030.0304.75
4.4.70.0050.0214.75
4.4.60.0040.0204.76
4.4.50.0080.0334.77
4.4.40.0040.0324.71
4.4.30.0040.0324.76
4.4.20.0050.0214.85
4.4.10.0060.0394.85
4.4.00.0060.0264.76
4.3.110.0040.0204.67
4.3.100.0100.0144.67
4.3.90.0030.0184.63
4.3.80.0060.0244.59
4.3.70.0040.0134.63
4.3.60.0040.0154.63
4.3.50.0080.0434.63
4.3.40.0030.0274.54
4.3.30.0040.0163.28
4.3.20.0050.0153.26
4.3.10.0040.0153.23
4.3.00.0030.02710.30

preferences:
31.95 ms | 401 KiB | 5 Q