3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileSize = new fileSize(); $minHeight = 180; $minWidth = 180; $shortestSide = 180; if ($fileSize->getWidth() > $fileSize->getHeight()) { if ($fileSize->getHeight() > $minHeight) { $width = round($fileSize->getWidth() * ($minHeight / $fileSize->getHeight())); $height = $shortestSide; } } elseif ($fileSize->getHeight() > $fileSize->getWidth()) { $height = round($fileSize->getHeight() * ($minWidth / $fileSize->getWidth())); $width = $shortestSide; } elseif ($height === $width) { $height = $minHeight; $width = $minWidth; } return ['width' => $width, 'height' => $height]; class fileSize { public function getWidth() { return 1200; } public function getHeight() { return 630; } }

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)
8.3.60.0120.00616.50
8.3.50.0120.00922.90
8.3.40.0150.00018.87
8.3.30.0110.00419.16
8.3.20.0080.00020.33
8.3.10.0080.00021.90
8.3.00.0040.00419.27
8.2.180.0090.00618.06
8.2.170.0140.00322.96
8.2.160.0100.00320.54
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0060.00326.16
8.2.120.0040.00420.99
8.2.110.0000.00922.20
8.2.100.0080.00417.84
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0000.00717.93
8.2.50.0000.00818.07
8.2.40.0000.00820.01
8.2.30.0070.00018.34
8.2.20.0040.00417.82
8.2.10.0030.00518.25
8.2.00.0000.00817.86
8.1.280.0040.01125.92
8.1.270.0050.00322.26
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.24
8.1.230.0060.00619.13
8.1.220.0030.00617.74
8.1.210.0060.00318.77
8.1.200.0040.00417.38
8.1.190.0030.00817.35
8.1.180.0030.00618.10
8.1.170.0030.00618.51
8.1.160.0070.00021.89
8.1.150.0030.00518.91
8.1.140.0020.00517.50
8.1.130.0070.00017.88
8.1.120.0000.00717.38
8.1.110.0040.00417.35
8.1.100.0050.00317.29
8.1.90.0000.00817.47
8.1.80.0070.00017.36
8.1.70.0030.00317.48
8.1.60.0030.00517.68
8.1.50.0030.00517.61
8.1.40.0030.00617.46
8.1.30.0040.00417.75
8.1.20.0050.00317.72
8.1.10.0040.00417.63
8.1.00.0030.00617.55
8.0.300.0040.00418.77
8.0.290.0050.00317.05
8.0.280.0030.00318.52
8.0.270.0030.00317.24
8.0.260.0030.00317.21
8.0.250.0040.00416.97
8.0.240.0030.00317.00
8.0.230.0040.00417.00
8.0.220.0000.00716.88
8.0.210.0080.00016.98
8.0.200.0030.00317.03
8.0.190.0050.00216.96
8.0.180.0060.00316.86
8.0.170.0040.00416.94
8.0.160.0030.00316.79
8.0.150.0000.00716.75
8.0.140.0030.00416.90
8.0.130.0030.00313.31
8.0.120.0000.00816.86
8.0.110.0040.00416.93
8.0.100.0000.00716.85
8.0.90.0020.00516.97
8.0.80.0090.00616.79
8.0.70.0040.00416.86
8.0.60.0040.00417.02
8.0.50.0000.00716.87
8.0.30.0090.01117.25
8.0.20.0090.01117.40
8.0.10.0020.00516.90
8.0.00.0100.00816.82
7.4.330.0030.00315.03
7.4.320.0030.00316.62
7.4.300.0060.00016.65
7.4.290.0080.00016.61
7.4.280.0050.00316.55
7.4.270.0050.00216.58
7.4.260.0040.00416.56
7.4.250.0040.00416.68
7.4.240.0020.00516.61
7.4.230.0030.00316.60
7.4.220.0110.01116.45
7.4.210.0150.00416.44
7.4.200.0000.00816.65
7.4.160.0070.01016.33
7.4.150.0110.00717.40
7.4.140.0080.01017.86
7.4.130.0130.00916.61
7.4.120.0050.01216.58
7.4.110.0170.00716.41
7.4.100.0000.01716.48
7.4.90.0070.01016.68
7.4.80.0200.00319.39
7.4.70.0120.01216.37
7.4.60.0030.01316.45
7.4.50.0000.00816.40
7.4.40.0170.00316.72
7.4.30.0030.01316.65
7.4.00.0100.00714.52
7.3.330.0060.00013.43
7.3.320.0030.00313.36
7.3.310.0070.00016.53
7.3.300.0030.00316.41
7.3.290.0060.00916.43
7.3.280.0080.00916.41
7.3.270.0040.01417.40
7.3.260.0060.01216.36
7.3.240.0110.00716.36
7.3.230.0070.01116.74
7.3.210.0070.01116.62
7.3.200.0070.01119.39
7.3.190.0170.00016.64
7.3.180.0060.00916.52
7.3.170.0080.00816.45
7.3.160.0030.01316.40
7.2.330.0090.00916.90
7.2.320.0170.00016.82
7.2.310.0120.01216.85
7.2.300.0110.00616.52
7.2.290.0140.00816.90
7.2.00.0080.00419.22
7.1.100.0070.00718.27
7.1.70.0000.00717.35
7.1.60.0150.00919.57
7.1.50.0140.01016.94
7.1.00.0100.07022.37
7.0.200.0000.01816.80
7.0.140.0030.04021.98
7.0.60.0030.04720.05
7.0.50.0130.07018.00
7.0.40.0070.04720.04
7.0.30.0370.06320.24
7.0.20.0270.07020.24
7.0.10.0070.08720.30
7.0.00.0070.08320.05
5.6.280.0070.06720.93
5.6.210.0000.07020.53
5.6.200.0170.07718.29
5.6.190.0100.08020.47
5.6.180.0470.07720.64
5.6.170.0330.07020.50
5.6.160.0030.06720.68
5.6.150.0000.05718.15
5.6.140.0030.06318.17
5.6.130.0070.08718.27
5.6.120.0170.07321.13
5.6.110.0070.08321.14
5.6.100.0100.06721.12
5.6.90.0100.07721.00
5.6.80.0100.06320.51
5.5.350.0270.07720.33
5.5.340.0030.04018.08
5.5.330.0170.07320.13
5.5.320.0300.05020.35
5.5.310.0300.05020.34
5.5.300.0070.04017.94
5.5.290.0170.07318.08
5.5.280.0030.05020.85
5.5.270.0070.03720.82
5.5.260.0000.08720.76
5.5.250.0030.04720.62
5.5.240.0030.07320.28
5.4.450.0200.04719.42
5.4.440.0230.04719.39
5.4.430.0200.04719.54
5.4.420.0200.03719.19
5.4.410.0130.03719.25
5.4.400.0230.03318.87
5.4.390.0170.03719.28
5.4.380.0100.04018.86
5.4.370.0200.04019.09
5.4.360.0130.04319.25
5.4.350.0200.03319.38
5.4.340.0130.04019.09
5.4.320.0130.06318.87
5.4.310.0130.04019.15
5.4.300.0200.04019.25
5.4.290.0200.03319.25
5.4.280.0230.04019.14
5.4.270.0270.06718.87
5.4.260.0270.08319.03
5.4.250.0170.04319.25
5.4.240.0230.04019.07
5.4.230.0230.03719.20
5.4.220.0170.03319.23
5.4.210.0200.03718.85
5.4.200.0200.03719.07
5.4.190.0170.04319.14
5.4.180.0170.04019.14
5.4.170.0200.03719.21
5.4.160.0300.02318.96
5.4.150.0100.04319.06
5.4.140.0130.03716.35
5.4.130.0170.03316.34
5.4.120.0070.04316.30
5.4.110.0100.04716.58
5.4.100.0170.04316.54
5.4.90.0130.03716.25
5.4.80.0170.03316.36
5.4.70.0130.04316.44
5.4.60.0270.05716.23
5.4.50.0170.07016.53
5.4.40.0170.03316.34
5.4.30.0230.03316.22
5.4.20.0100.04016.53
5.4.10.0100.04016.55
5.4.00.0130.03715.88
5.3.290.0330.02714.65
5.3.280.0270.03314.47
5.3.270.0230.04014.45
5.3.260.0230.03714.63
5.3.250.0170.03314.47
5.3.240.0270.04314.55
5.3.230.0170.03714.48
5.3.220.0170.03314.41
5.3.210.0100.04014.62
5.3.200.0200.03314.42
5.3.190.0130.03714.41
5.3.180.0130.04314.42
5.3.170.0130.04014.41
5.3.160.0230.04314.50
5.3.150.0170.03314.51
5.3.140.0200.03014.51
5.3.130.0200.03714.50
5.3.120.0100.04014.46
5.3.110.0100.04014.58
5.3.100.0170.03313.87
5.3.90.0230.06713.86
5.3.80.0100.04013.87
5.3.70.0130.04013.85
5.3.60.0230.06714.05
5.3.50.0200.03313.89
5.3.40.0200.04013.93
5.3.30.0170.04313.94
5.3.20.0230.03013.63
5.3.10.0170.04713.61
5.3.00.0230.06713.52
5.2.170.0100.03311.20
5.2.160.0100.03010.99
5.2.150.0170.03311.08
5.2.140.0170.05711.08
5.2.130.0200.02710.95
5.2.120.0200.04010.95
5.2.110.0130.03010.96
5.2.100.0170.02710.96
5.2.90.0130.02710.96
5.2.80.0130.03311.19
5.2.70.0170.02711.00
5.2.60.0130.02711.07
5.2.50.0070.03310.98
5.2.40.0100.02710.83
5.2.30.0070.03010.81
5.2.20.0100.03011.05
5.2.10.0100.03010.93
5.2.00.0070.03710.66
5.1.60.0100.02310.04
5.1.50.0200.01710.04
5.1.40.0130.03310.14
5.1.30.0130.02310.29
5.1.20.0100.03010.32
5.1.10.0100.02310.05
5.1.00.0130.02010.04
5.0.50.0070.02310.04
5.0.40.0130.04010.04
5.0.30.0070.03310.04
5.0.20.0070.02010.04
5.0.10.0030.03010.04
5.0.00.0030.03310.04
4.4.90.0070.01310.04
4.4.80.0030.01710.04
4.4.70.0030.02010.04
4.4.60.0070.01310.04
4.4.50.0030.01710.04
4.4.40.0070.02310.04
4.4.30.0030.01710.04
4.4.20.0070.01710.04
4.4.10.0030.01710.04
4.4.00.0000.04010.04
4.3.110.0130.01710.04
4.3.100.0030.01710.04
4.3.90.0030.02310.04
4.3.80.0070.02310.04
4.3.70.0030.01710.04
4.3.60.0130.03010.04
4.3.50.0070.02310.04
4.3.40.0030.02710.04
4.3.30.0030.02710.04
4.3.20.0070.01710.04
4.3.10.0030.01710.04
4.3.00.0000.02010.04

preferences:
56.83 ms | 401 KiB | 5 Q