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]*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)
7.2.00.0030.00619.20
7.1.70.0000.00717.55
7.1.60.0030.01019.46
7.1.50.0130.01317.20
7.1.00.0070.07322.59
7.0.200.0030.00316.97
7.0.140.0030.07722.24
7.0.60.0200.07320.21
7.0.50.0030.08718.21
7.0.40.0070.08020.34
7.0.30.0400.07720.48
7.0.20.0300.07720.34
7.0.10.0370.03720.55
7.0.00.0000.04320.30
5.6.280.0030.07321.18
5.6.210.0230.07320.70
5.6.200.0030.09018.38
5.6.190.0070.04020.53
5.6.180.0300.07720.52
5.6.170.0300.07320.64
5.6.160.0030.09020.65
5.6.150.0000.06718.42
5.6.140.0070.08018.34
5.6.130.0030.05718.37
5.6.120.0100.08321.25
5.6.110.0130.05321.30
5.6.100.0070.08321.23
5.6.90.0100.08021.27
5.6.80.0070.07320.63
5.6.70.0000.03320.60
5.5.350.0170.07320.73
5.5.340.0070.08018.27
5.5.330.0100.03720.50
5.5.320.0130.07720.70
5.5.310.0230.04320.51
5.5.300.0100.06318.22
5.5.290.0100.05018.27
5.5.280.0070.04021.16
5.5.270.0000.06021.00
5.5.260.0030.04720.98
5.5.250.0170.07020.82
5.5.240.0170.07320.39
5.4.450.0600.06319.89
5.4.440.0300.05719.56
5.4.430.0430.05719.36
5.4.420.0200.06019.88
5.4.410.0200.06019.66
5.4.400.0370.05019.45
5.4.390.0230.05319.34
5.4.380.0270.06018.93
5.4.370.0300.05318.93
5.4.360.0170.05718.79
5.4.350.0230.07318.90
5.4.340.0330.07018.79
5.4.320.0080.03412.55
5.4.310.0120.04812.55
5.4.300.0060.03712.55
5.4.290.0070.03712.55
5.4.280.0110.04612.43
5.4.270.0170.05212.42
5.4.260.0210.07212.43
5.4.250.0130.05312.41
5.4.240.0070.05312.42
5.4.230.0120.08612.41
5.4.220.0130.08012.41
5.4.210.0100.04912.42
5.4.200.0090.05612.41
5.4.190.0190.06612.41
5.4.180.0090.07812.41
5.4.170.0150.06012.43
5.4.160.0090.05212.41
5.4.150.0220.08312.41
5.4.140.0220.09512.09
5.4.130.0200.06912.08
5.4.120.0100.08112.04
5.4.110.0200.12112.07
5.4.100.0130.05012.04
5.4.90.0120.07212.04
5.4.80.0190.09312.04
5.4.70.0220.06912.03
5.4.60.0090.05612.03
5.4.50.0180.07512.04
5.4.40.0220.07012.02
5.4.30.0150.06212.01
5.4.20.0070.05412.01
5.4.10.0150.05412.02
5.4.00.0070.04611.51
5.3.290.0040.04112.81
5.3.280.0090.05612.71
5.3.270.0150.04812.73
5.3.260.0200.05812.73
5.3.250.0160.04712.72
5.3.240.0170.06612.73
5.3.230.0170.09812.72
5.3.220.0210.06412.70
5.3.210.0150.06312.69
5.3.200.0190.08412.69
5.3.190.0160.10012.69
5.3.180.0250.08112.68
5.3.170.0330.09112.68
5.3.160.0160.05812.68
5.3.150.0230.04912.69
5.3.140.0230.04712.67
5.3.130.0210.07712.67
5.3.120.0190.09412.68
5.3.110.0080.07512.66
5.3.100.0100.04812.15
5.3.90.0160.07612.13
5.3.80.0180.05312.13
5.3.70.0130.06512.13
5.3.60.0080.04412.11
5.3.50.0110.04212.05
5.3.40.0850.06312.05
5.3.30.0210.06212.02
5.3.20.0210.07211.80
5.3.10.0340.07911.76
5.3.00.0100.06611.76
5.2.170.0150.0509.25
5.2.160.0270.1049.24
5.2.150.0270.0719.25
5.2.140.0250.0609.24
5.2.130.0090.0429.20
5.2.120.0320.0789.20
5.2.110.0090.0569.20
5.2.100.0200.1109.21
5.2.90.0090.0309.21
5.2.80.0130.0489.20
5.2.70.0180.0479.20
5.2.60.0060.0519.16
5.2.50.0120.0679.13
5.2.40.0130.0509.10
5.2.30.0090.0469.08
5.2.20.0180.0589.06
5.2.10.0130.0419.02
5.2.00.0170.0558.86
5.1.60.0110.0538.14
5.1.50.0330.0708.14
5.1.40.0060.0348.13
5.1.30.0120.0418.47
5.1.20.0090.0658.50
5.1.10.0080.0378.23
5.1.00.0130.0308.22
5.0.50.0060.0306.70
5.0.40.0080.0516.58
5.0.30.0050.0516.38
5.0.20.0070.0206.36
5.0.10.0030.0256.33
5.0.00.0050.0336.32
4.4.90.0040.0214.78
4.4.80.0050.0184.76
4.4.70.0030.0184.75
4.4.60.0040.0154.75
4.4.50.0030.0174.77
4.4.40.0040.0274.70
4.4.30.0040.0174.76
4.4.20.0040.0174.84
4.4.10.0140.0164.85
4.4.00.0100.0554.76
4.3.110.0040.0164.67
4.3.100.0040.0184.66
4.3.90.0130.0224.64
4.3.80.0170.0594.59
4.3.70.0080.0494.63
4.3.60.0070.0344.63
4.3.50.0180.0494.63
4.3.40.0090.0474.54
4.3.30.0140.0583.28
4.3.20.0230.0673.27
4.3.10.0070.0303.23
4.3.00.0200.02310.30

preferences:
41.4 ms | 401 KiB | 5 Q