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; echo 'LineHeight = '.$lineHeight."\r\n"; $lineWidthDiv = 0; foreach ( $angles as $angle ) { $lineWidthDiv += cos($angle*pi()/180); } $lineWidth = ($point->X-$mouseX)/$lineWidthDiv; 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-1]*pi()/180); $y = $points[$i-1]->Y + $lineHeight*sin($angles[$i-1]*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)
7.2.00.0030.01219.60
7.1.70.0100.01017.57
7.1.60.0030.01019.46
7.1.50.0110.01516.73
7.1.00.0030.07722.74
7.0.200.0030.00517.24
7.0.140.0000.07722.16
7.0.60.0130.08020.14
7.0.50.0030.04018.03
7.0.40.0000.09020.49
7.0.30.0200.05020.34
7.0.20.0270.03720.52
7.0.10.0130.08020.48
7.0.00.0070.04020.42
5.6.280.0070.07021.36
5.6.210.0130.08020.95
5.6.200.0070.04018.46
5.6.190.0130.07720.52
5.6.180.4030.04020.86
5.6.170.0300.07320.80
5.6.160.0070.07020.66
5.6.150.0030.07718.29
5.6.140.0070.07318.43
5.6.130.0130.04318.23
5.6.120.0130.06721.17
5.6.110.0070.08321.35
5.6.100.0100.03321.34
5.6.90.0070.05021.36
5.6.80.0070.03720.74
5.5.350.0230.05020.62
5.5.340.0100.07718.27
5.5.330.0030.04720.61
5.5.320.0170.04720.55
5.5.310.0270.06020.69
5.5.300.0070.03718.28
5.5.290.0000.08718.20
5.5.280.0030.05721.04
5.5.270.0030.09320.96
5.5.260.0000.08321.01
5.5.250.0070.03720.90
5.5.240.0070.04020.49
5.4.450.0770.04019.75
5.4.440.0900.05019.73
5.4.430.0570.04719.32
5.4.420.1200.03719.57
5.4.410.0770.03319.69
5.4.400.0930.03319.09
5.4.390.0270.04319.28
5.4.380.0270.06318.92
5.4.370.0300.05318.89
5.4.360.0470.05718.75
5.4.350.0470.07318.91
5.4.340.0400.05018.75
5.4.320.0050.03712.55
5.4.310.0040.03912.54
5.4.300.0080.04912.55
5.4.290.0080.04512.55
5.4.280.0060.05412.42
5.4.270.0110.03612.41
5.4.260.0080.03812.42
5.4.250.0060.04012.43
5.4.240.0070.03912.42
5.4.230.0070.04312.41
5.4.220.0050.04512.41
5.4.210.0020.04112.41
5.4.200.0110.03912.41
5.4.190.0060.03612.41
5.4.180.0060.03612.41
5.4.170.0060.04012.41
5.4.160.0040.04012.42
5.4.150.0070.03612.41
5.4.140.0070.04012.09
5.4.130.0050.03612.08
5.4.120.0030.04912.04
5.4.110.0100.05812.04
5.4.100.0120.04412.04
5.4.90.0100.05012.04
5.4.80.0060.04212.03
5.4.70.0080.03212.03
5.4.60.0100.03012.03
5.4.50.0060.03612.04
5.4.40.0080.04812.02
5.4.30.0110.04412.02
5.4.20.0080.04412.02
5.4.10.0100.04112.02
5.4.00.0100.04011.52
5.3.290.0030.04212.81
5.3.280.0120.05012.71
5.3.270.0120.05512.72
5.3.260.0110.05212.73
5.3.250.0110.05012.73
5.3.240.0110.03512.73
5.3.230.0070.04312.72
5.3.220.0110.04912.69
5.3.210.0090.03912.69
5.3.200.0080.03612.70
5.3.190.0070.03912.69
5.3.180.0050.03912.68
5.3.170.0050.04012.68
5.3.160.0140.04512.68
5.3.150.0100.07212.68
5.3.140.0110.04712.68
5.3.130.0090.04812.66
5.3.120.0120.05112.67
5.3.110.0120.04112.67
5.3.100.0080.03712.15
5.3.90.0100.04112.13
5.3.80.0090.04012.12
5.3.70.0080.04912.13
5.3.60.0130.05312.12
5.3.50.0080.04712.06
5.3.40.0060.04012.09
5.3.30.0080.03612.02
5.3.20.0060.03711.79
5.3.10.0070.03711.77
5.3.00.0060.03811.75
5.2.170.0030.0349.25
5.2.160.0100.0269.25
5.2.150.0050.0489.25
5.2.140.0110.0389.25
5.2.130.0030.0369.21
5.2.120.0110.0479.21
5.2.110.0120.0359.21
5.2.100.0060.0409.21
5.2.90.0090.0369.21
5.2.80.0140.0459.20
5.2.70.0120.0399.21
5.2.60.0120.0489.16
5.2.50.0120.0549.13
5.2.40.0090.0429.10
5.2.30.0110.0389.09
5.2.20.0100.0509.06
5.2.10.0090.0579.00
5.2.00.0100.0668.86
5.1.60.0120.0548.15
5.1.50.0130.0498.14
5.1.40.0110.0568.13
5.1.30.0080.0368.48
5.1.20.0100.0478.49
5.1.10.0050.0368.22
5.1.00.0090.0458.23
5.0.50.0080.0266.71
5.0.40.0050.0266.57
5.0.30.0080.0546.38
5.0.20.0070.0266.36
5.0.10.0020.0256.33
5.0.00.0020.0336.32
4.4.90.0040.0164.78
4.4.80.0050.0164.76
4.4.70.0010.0204.75
4.4.60.0030.0204.76
4.4.50.0050.0224.77
4.4.40.0040.0304.71
4.4.30.0050.0144.76
4.4.20.0040.0174.84
4.4.10.0040.0184.85
4.4.00.0030.0304.76
4.3.110.0060.0164.67
4.3.100.0030.0204.66
4.3.90.0120.0224.64
4.3.80.0050.0304.58
4.3.70.0060.0184.63
4.3.60.0090.0304.63
4.3.50.0050.0264.63
4.3.40.0070.0394.53
4.3.30.0060.0443.28
4.3.20.0000.0283.26
4.3.10.0090.0333.23
4.3.00.0270.02013.47

preferences:
41.04 ms | 400 KiB | 5 Q