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)/$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*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.10.0040.01415.16
7.4.00.0040.01215.48
7.3.130.0100.00715.04
7.3.120.0100.00715.37
7.3.110.0030.01014.91
7.3.100.0030.01015.29
7.3.90.0030.01315.49
7.3.80.0040.01115.30
7.3.70.0040.00815.20
7.3.60.0030.01015.08
7.3.50.0030.01015.15
7.3.40.0000.01415.21
7.3.30.0070.00714.94
7.3.20.0000.01417.10
7.3.10.0090.00917.04
7.3.00.0060.00916.77
7.2.260.0140.00315.45
7.2.250.0070.01315.43
7.2.240.0000.01315.27
7.2.230.0060.00315.31
7.2.220.0070.01115.67
7.2.210.0070.01015.67
7.2.200.0030.01415.45
7.2.190.0060.00315.43
7.2.180.0040.01115.42
7.2.170.0060.00915.30
7.2.160.0030.01115.64
7.2.150.0030.01217.29
7.2.140.0030.01317.34
7.2.130.0090.00617.41
7.2.120.0100.00717.09
7.2.110.0110.00417.29
7.2.100.0120.00617.50
7.2.90.0110.00617.21
7.2.80.0080.00817.42
7.2.70.0030.01417.59
7.2.60.0120.00617.53
7.2.50.0070.01017.29
7.2.40.0040.01517.42
7.2.30.0040.00817.48
7.2.20.0100.00316.98
7.2.10.0030.01217.16
7.2.00.0030.01118.53
7.1.330.0030.01015.91
7.1.320.0120.00316.21
7.1.310.0060.00916.30
7.1.300.0030.01016.14
7.1.290.0040.00815.86
7.1.280.0140.00016.25
7.1.270.0030.01316.26
7.1.260.0060.00315.85
7.1.250.0100.00315.96
7.1.240.0030.01216.16
7.1.230.0090.00616.27
7.1.220.0100.00316.34
7.1.210.0090.00616.31
7.1.200.0030.01116.10
7.1.190.0040.01116.33
7.1.180.0030.01116.05
7.1.170.0090.00916.32
7.1.160.0070.01116.28
7.1.150.0060.00616.24
7.1.140.0110.00316.08
7.1.130.0070.00716.18
7.1.120.0040.00816.16
7.1.110.0030.01215.95
7.1.100.0080.00416.01
7.1.90.0070.00716.42
7.1.80.0100.00715.90
7.1.70.0040.00716.73
7.1.60.0080.00817.84
7.1.50.0070.01316.78
7.1.40.0100.00316.20
7.1.30.0000.01416.32
7.1.20.0030.01016.30
7.1.10.0070.00316.16
7.1.00.0100.03819.39
7.0.330.0110.00315.73
7.0.320.0060.00615.78
7.0.310.0040.00815.77
7.0.300.0130.00315.67
7.0.290.0070.01015.86
7.0.280.0070.00715.58
7.0.270.0090.00015.55
7.0.260.0080.00415.42
7.0.250.0080.00616.01
7.0.240.0040.01115.81
7.0.230.0070.00715.96
7.0.220.0060.00615.79
7.0.210.0060.00615.68
7.0.200.0040.00516.53
7.0.190.0000.01515.79
7.0.180.0000.00815.79
7.0.170.0080.00315.57
7.0.160.0030.01015.92
7.0.150.0030.01315.79
7.0.140.0050.03819.01
7.0.130.0070.00315.87
7.0.120.0060.00615.93
7.0.110.0040.01115.91
7.0.100.0080.00415.53
7.0.90.0060.00315.73
7.0.80.0000.00915.80
7.0.70.0000.00815.52
7.0.60.0140.04318.08
7.0.50.0020.02817.08
7.0.40.0070.02517.09
7.0.30.0330.03216.90
7.0.20.0150.03717.01
7.0.10.0050.04317.07
7.0.00.0030.03017.04
5.6.400.0110.00614.68
5.6.390.0060.01014.96
5.6.380.0000.01114.83
5.6.370.0000.01315.02
5.6.360.0100.00714.69
5.6.350.0070.01014.66
5.6.340.0030.01014.36
5.6.330.0070.00414.80
5.6.320.0030.01014.87
5.6.310.0000.01215.02
5.6.300.0090.00915.26
5.6.290.0040.01115.11
5.6.280.0050.04018.04
5.6.270.0070.00714.78
5.6.260.0090.00314.89
5.6.250.0040.00414.70
5.6.240.0000.01015.12
5.6.230.0000.01014.78
5.6.220.0060.01214.87
5.6.210.0100.04017.82
5.6.200.0070.03516.67
5.6.190.0060.04517.86
5.6.180.0200.04017.77
5.6.170.0170.03017.75
5.6.160.0080.04517.74
5.6.150.0100.04216.47
5.6.140.0030.04216.79
5.6.130.0070.02716.70
5.6.120.0080.02217.91
5.6.110.0070.04418.03
5.6.100.0050.04117.96
5.6.90.0120.04218.00
5.6.80.0100.03317.59
5.6.70.0040.01214.79
5.6.60.0090.00614.94
5.6.50.0030.00615.09
5.6.40.0080.00814.75
5.6.30.0040.01114.61
5.6.20.0000.01114.55
5.6.10.0060.00914.93
5.6.00.0040.00814.85
5.5.380.0000.01014.54
5.5.370.0040.00414.99
5.5.360.0030.01214.80
5.5.350.0120.03017.76
5.5.340.0110.03416.52
5.5.330.0030.03017.66
5.5.320.0100.04517.75
5.5.310.0250.03717.72
5.5.300.0110.03316.46
5.5.290.0030.04716.47
5.5.280.0020.02618.00
5.5.270.0050.05318.03
5.5.260.0070.04417.94
5.5.250.0070.04217.94
5.5.240.0200.03917.70
5.5.230.0100.00314.83
5.5.220.0110.00414.44
5.5.210.0030.01014.76
5.5.200.0030.01014.85
5.5.190.0060.00314.89
5.5.180.0030.01014.88
5.5.170.0110.00714.60
5.5.160.0060.00814.75
5.5.150.0000.01514.62
5.5.140.0070.00714.56
5.5.130.0000.00914.84
5.5.120.0090.00014.61
5.5.110.0040.01214.82
5.5.100.0100.01014.65
5.5.90.0070.01314.88
5.5.80.0070.00714.87
5.5.70.0100.00614.46
5.5.60.0100.00314.55
5.5.50.0060.00914.82
5.5.40.0030.01314.41
5.5.30.0040.01114.89
5.5.20.0060.00614.86
5.5.10.0000.01214.66
5.5.00.0070.00714.75
5.4.450.0430.03015.43
5.4.440.0130.03015.55
5.4.430.0130.03615.65
5.4.420.0180.02515.63
5.4.410.0100.03115.38
5.4.400.0200.03015.41
5.4.390.0160.03215.41
5.4.380.0180.02715.16
5.4.370.0180.02815.09
5.4.360.0150.03515.32
5.4.350.0150.03915.14
5.4.340.0160.04115.12
5.4.330.0040.00711.36
5.4.320.0050.02312.08
5.4.310.0090.02011.95
5.4.300.0080.02011.97
5.4.290.0040.02412.09
5.4.280.0080.03211.97
5.4.270.0070.02811.86
5.4.260.0090.02911.77
5.4.250.0070.03212.07
5.4.240.0090.03011.96
5.4.230.0050.03212.04
5.4.220.0180.04111.90
5.4.210.0110.02611.98
5.4.200.0080.02812.01
5.4.190.0070.02611.92
5.4.180.0080.02011.73
5.4.170.0080.02112.03
5.4.160.0090.02611.93
5.4.150.0060.03011.78
5.4.140.0070.02811.93
5.4.130.0070.02611.86
5.4.120.0020.02411.86
5.4.110.0060.02511.74
5.4.100.0060.02411.69
5.4.90.0050.02911.58
5.4.80.0040.02811.67
5.4.70.0080.02711.79
5.4.60.0060.02111.64
5.4.50.0070.02111.67
5.4.40.0080.02711.83
5.4.30.0030.02611.83
5.4.20.0070.02211.68
5.4.10.0070.02111.71
5.4.00.0100.01911.39
5.3.290.0040.02212.01
5.3.280.0040.02611.83
5.3.270.0040.03111.77
5.3.260.0060.03011.85
5.3.250.0070.02611.81
5.3.240.0080.03611.71
5.3.230.0070.04011.78
5.3.220.0060.02911.74
5.3.210.0100.02211.84
5.3.200.0250.07711.84
5.3.190.0060.03411.86
5.3.180.0100.02711.93
5.3.170.0080.02811.92
5.3.160.0080.03211.74
5.3.150.0080.03111.92
5.3.140.0080.02811.94
5.3.130.0080.02911.84
5.3.120.0100.02311.87
5.3.110.0120.02511.90
5.3.100.0090.02411.44
5.3.90.0070.03011.58
5.3.80.0090.02611.52
5.3.70.0080.02611.52
5.3.60.0090.02611.50
5.3.50.0040.02911.38
5.3.40.0070.03211.58
5.3.30.0100.02911.59
5.3.20.0110.02711.42
5.3.10.0040.03311.28
5.3.00.0070.03111.22
5.2.170.0100.0449.25
5.2.160.0080.0489.25
5.2.150.0100.0469.26
5.2.140.0120.0429.25
5.2.130.0060.0459.21
5.2.120.0080.0429.23
5.2.110.0080.0439.21
5.2.100.0080.0459.22
5.2.90.0090.0469.22
5.2.80.0080.0469.21
5.2.70.0090.0469.21
5.2.60.0070.0489.17
5.2.50.0050.0489.14
5.2.40.0080.0429.11
5.2.30.0070.0479.09
5.2.20.0070.0439.07
5.2.10.0130.0388.99
5.2.00.0110.0428.85
5.1.60.0070.0338.13
5.1.50.0090.0338.15
5.1.40.0090.0338.11
5.1.30.0140.0368.46
5.1.20.0090.0398.48
5.1.10.0100.0348.21
5.1.00.0050.0278.21
5.0.50.0060.0266.69
5.0.40.0090.0266.56
5.0.30.0090.0346.37
5.0.20.0050.0256.34
5.0.10.0030.0296.31
5.0.00.0050.0396.31
4.4.90.0020.0214.77
4.4.80.0020.0204.75
4.4.70.0050.0184.75
4.4.60.0040.0244.75
4.4.50.0050.0224.77
4.4.40.0060.0284.71
4.4.30.0060.0204.76
4.4.20.0040.0224.84
4.4.10.0050.0194.85
4.4.00.0060.0364.76
4.3.110.0050.0254.67
4.3.100.0050.0244.67
4.3.90.0060.0224.63
4.3.80.0050.0344.58
4.3.70.0040.0244.63
4.3.60.0070.0204.63
4.3.50.0060.0234.63
4.3.40.0050.0334.54
4.3.30.0040.0203.28
4.3.20.0030.0223.26
4.3.10.0040.0153.23
4.3.00.0070.02710.30

preferences:
58.69 ms | 400 KiB | 5 Q