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*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.01915.27
7.4.00.0070.01015.14
7.3.130.0060.01515.13
7.3.120.0100.00715.21
7.3.110.0070.01115.15
7.3.100.0030.01315.43
7.3.90.0060.00915.21
7.3.80.0030.01015.19
7.3.70.0060.01214.98
7.3.60.0120.00015.29
7.3.50.0000.01215.33
7.3.40.0090.00615.19
7.3.30.0080.00815.29
7.3.20.0060.00617.10
7.3.10.0100.00317.02
7.3.00.0050.00816.72
7.2.260.0130.00715.62
7.2.250.0120.00915.42
7.2.240.0030.01315.40
7.2.230.0070.01115.56
7.2.220.0030.01015.34
7.2.210.0100.00615.30
7.2.200.0090.00915.32
7.2.190.0150.00015.48
7.2.180.0030.00715.14
7.2.170.0100.00915.50
7.2.160.0040.01415.21
7.2.150.0100.00317.43
7.2.140.0150.00017.30
7.2.130.0040.00817.34
7.2.120.0090.00017.22
7.2.110.0140.00317.34
7.2.100.0040.01517.16
7.2.90.0040.01117.30
7.2.80.0100.00317.00
7.2.70.0000.01416.94
7.2.60.0040.00717.26
7.2.50.0070.01017.00
7.2.40.0070.01017.43
7.2.30.0080.00817.34
7.2.20.0000.01217.19
7.2.10.0000.01817.26
7.2.00.0050.01118.56
7.1.330.0040.01116.19
7.1.320.0030.01216.13
7.1.310.0070.01115.91
7.1.300.0070.00316.17
7.1.290.0090.00316.04
7.1.280.0060.01216.21
7.1.270.0070.00716.28
7.1.260.0060.00615.91
7.1.250.0000.01016.16
7.1.240.0130.00016.18
7.1.230.0100.00716.11
7.1.220.0060.01216.13
7.1.210.0070.00716.11
7.1.200.0000.01516.17
7.1.190.0090.00416.21
7.1.180.0030.00616.14
7.1.170.0030.00716.33
7.1.160.0000.01216.28
7.1.150.0060.01015.96
7.1.140.0100.00316.23
7.1.130.0100.00715.96
7.1.120.0070.00715.93
7.1.110.0060.00916.21
7.1.100.0000.01416.03
7.1.90.0090.00616.24
7.1.80.0040.00816.24
7.1.70.0030.00716.94
7.1.60.0080.01217.85
7.1.50.0040.01216.74
7.1.40.0130.00316.36
7.1.30.0060.00616.32
7.1.20.0120.00016.21
7.1.10.0060.01016.10
7.1.00.0000.04519.48
7.0.330.0000.01415.45
7.0.320.0080.00815.86
7.0.310.0040.01115.83
7.0.300.0030.00715.77
7.0.290.0100.00315.73
7.0.280.0040.01115.52
7.0.270.0120.00315.43
7.0.260.0070.00715.79
7.0.250.0090.00015.93
7.0.240.0040.01115.52
7.0.230.0040.01115.64
7.0.220.0000.00816.00
7.0.210.0040.01215.47
7.0.200.0080.00316.45
7.0.190.0110.00715.88
7.0.180.0070.01115.79
7.0.170.0040.01115.63
7.0.160.0070.01015.93
7.0.150.0090.00615.42
7.0.140.0030.04018.92
7.0.130.0060.00615.69
7.0.120.0000.01015.89
7.0.110.0110.00415.87
7.0.100.0070.00715.84
7.0.90.0070.01015.83
7.0.80.0030.00915.64
7.0.70.0030.00915.79
7.0.60.0080.03617.89
7.0.50.0070.04017.05
7.0.40.0080.04217.13
7.0.30.0330.03817.15
7.0.20.0120.02817.12
7.0.10.0050.03717.12
7.0.00.0090.04617.10
5.6.400.0000.01714.54
5.6.390.0090.00314.63
5.6.380.0110.00615.31
5.6.370.0030.01314.60
5.6.360.0040.01214.88
5.6.350.0110.00714.49
5.6.340.0040.00814.84
5.6.330.0070.00714.78
5.6.320.0160.00014.57
5.6.310.0100.00314.75
5.6.300.0030.00714.81
5.6.290.0060.01014.71
5.6.280.0060.03717.97
5.6.270.0100.00614.74
5.6.260.0070.00714.91
5.6.250.0060.01114.86
5.6.240.0040.00814.94
5.6.230.0070.00715.14
5.6.220.0060.00614.99
5.6.210.0100.04218.03
5.6.200.0100.03316.60
5.6.190.0050.02917.82
5.6.180.0190.02017.92
5.6.170.0120.04417.94
5.6.160.0030.02717.54
5.6.150.0080.04516.69
5.6.140.0100.03516.51
5.6.130.0050.02616.65
5.6.120.0080.04818.29
5.6.110.0110.04018.21
5.6.100.0070.03718.20
5.6.90.0030.04818.07
5.6.80.0100.04017.72
5.6.70.2070.02017.69
5.6.60.0100.00314.51
5.6.50.0100.00315.06
5.6.40.0070.00714.45
5.6.30.0140.00015.05
5.6.20.0030.01014.62
5.6.10.0070.00714.80
5.6.00.0050.00514.81
5.5.380.0070.00714.99
5.5.370.0070.00714.97
5.5.360.0000.01214.72
5.5.350.0070.03817.71
5.5.340.0100.02316.50
5.5.330.0070.04617.63
5.5.320.0100.02517.86
5.5.310.0200.03017.83
5.5.300.0070.03716.55
5.5.290.0090.03516.56
5.5.280.0070.02217.89
5.5.270.0100.04217.80
5.5.260.0140.03617.84
5.5.250.0070.04617.81
5.5.240.0100.03417.65
5.5.230.0090.00614.77
5.5.220.0060.00614.79
5.5.210.0000.01114.84
5.5.200.0060.00314.59
5.5.190.0000.01714.75
5.5.180.0040.01114.80
5.5.170.0060.00614.87
5.5.160.0030.00914.53
5.5.150.0060.01015.00
5.5.140.0030.01114.99
5.5.130.0070.01014.70
5.5.120.0030.01014.66
5.5.110.0070.00714.92
5.5.100.0060.00314.34
5.5.90.0090.00614.71
5.5.80.0030.00614.67
5.5.70.0000.01214.60
5.5.60.0060.00614.64
5.5.50.0000.01114.52
5.5.40.0100.00714.50
5.5.30.0060.01014.67
5.5.20.0110.00314.65
5.5.10.0100.00014.77
5.5.00.0070.00714.56
5.4.450.0260.03515.39
5.4.440.0120.03415.48
5.4.430.0080.03115.62
5.4.420.0100.03815.49
5.4.410.0180.03515.48
5.4.400.0120.03215.30
5.4.390.0200.02515.29
5.4.380.0180.02815.20
5.4.370.0170.02915.16
5.4.360.0230.02815.06
5.4.350.0230.03515.07
5.4.340.0150.03415.22
5.4.330.0040.00711.51
5.4.320.0100.02111.94
5.4.310.0060.02111.97
5.4.300.0060.02212.17
5.4.290.0050.02512.13
5.4.280.0140.05012.00
5.4.270.0150.05011.85
5.4.260.0180.05212.03
5.4.250.0200.06411.98
5.4.240.0120.06611.95
5.4.230.0130.03712.05
5.4.220.0100.04612.07
5.4.210.0100.04612.06
5.4.200.0400.12112.07
5.4.190.0130.03212.06
5.4.180.0070.05212.06
5.4.170.0150.04311.85
5.4.160.0560.03512.00
5.4.150.0100.02811.86
5.4.140.0070.04311.73
5.4.130.0140.03511.86
5.4.120.0090.02911.69
5.4.110.0050.02911.73
5.4.100.0100.02411.87
5.4.90.0080.02611.78
5.4.80.0080.03711.78
5.4.70.0100.02511.72
5.4.60.0050.02711.78
5.4.50.0070.03511.72
5.4.40.0080.03411.80
5.4.30.0150.05611.63
5.4.20.0060.03011.66
5.4.10.0060.02811.66
5.4.00.0090.04711.44
5.3.290.0020.02611.83
5.3.280.0090.03811.82
5.3.270.0070.03211.84
5.3.260.0090.02711.79
5.3.250.0050.04711.81
5.3.240.0110.03311.81
5.3.230.0090.02211.84
5.3.220.0070.02711.80
5.3.210.0040.02811.77
5.3.200.0070.02411.76
5.3.190.0040.02311.88
5.3.180.0070.03111.76
5.3.170.0130.02811.93
5.3.160.0060.02811.82
5.3.150.0090.02411.82
5.3.140.0060.02611.82
5.3.130.0100.02211.89
5.3.120.0080.03311.82
5.3.110.0050.02511.90
5.3.100.0100.02211.61
5.3.90.0090.02211.63
5.3.80.0080.02411.53
5.3.70.0040.02211.51
5.3.60.0060.02311.48
5.3.50.0080.02311.54
5.3.40.0110.03511.54
5.3.30.0150.04411.48
5.3.20.0110.03211.32
5.3.10.0100.04511.30
5.3.00.0100.02411.29
5.2.170.0100.0409.25
5.2.160.0060.0369.25
5.2.150.0080.0389.25
5.2.140.0110.0359.25
5.2.130.0100.0339.21
5.2.120.0070.0319.23
5.2.110.0070.0329.22
5.2.100.0080.0319.23
5.2.90.0060.0549.21
5.2.80.0150.0409.21
5.2.70.0080.0439.21
5.2.60.0060.0429.17
5.2.50.0100.0559.14
5.2.40.0130.0419.11
5.2.30.0060.0429.09
5.2.20.0230.0449.07
5.2.10.0190.0408.99
5.2.00.0150.0568.86
5.1.60.0160.0568.14
5.1.50.0100.0388.13
5.1.40.0090.0388.12
5.1.30.0160.0278.46
5.1.20.0060.0318.49
5.1.10.0100.0358.21
5.1.00.0120.0388.21
5.0.50.0060.0306.70
5.0.40.0080.0476.56
5.0.30.0140.0396.37
5.0.20.0120.0376.34
5.0.10.0210.0426.32
5.0.00.0090.0396.30
4.4.90.0030.0244.78
4.4.80.0030.0244.76
4.4.70.0070.0234.75
4.4.60.0010.0184.75
4.4.50.0020.0184.77
4.4.40.0060.0294.70
4.4.30.0080.0284.76
4.4.20.0030.0174.84
4.4.10.0060.0164.85
4.4.00.0040.0324.76
4.3.110.0030.0224.67
4.3.100.0030.0264.66
4.3.90.0040.0164.64
4.3.80.0030.0264.58
4.3.70.0010.0184.63
4.3.60.0040.0184.63
4.3.50.0060.0164.62
4.3.40.0040.0244.53
4.3.30.0030.0163.29
4.3.20.0040.0153.27
4.3.10.0020.0183.23
4.3.00.0330.03010.30

preferences:
37.37 ms | 401 KiB | 5 Q