3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileSize = new fileSize(); $minHeight = 180; $minWidth = 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.70.0060.01218.18
8.3.60.0070.01416.88
8.3.50.0120.00922.90
8.3.40.0120.00618.88
8.3.30.0110.00419.19
8.3.20.0080.00020.30
8.3.10.0050.00221.98
8.3.00.0000.00819.18
8.2.190.0000.01416.88
8.2.180.0040.01116.75
8.2.170.0000.01522.96
8.2.160.0110.00420.52
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00020.94
8.2.110.0090.00022.02
8.2.100.0040.00817.97
8.2.90.0060.00319.20
8.2.80.0040.00417.97
8.2.70.0090.00017.75
8.2.60.0040.00418.03
8.2.50.0000.00818.07
8.2.40.0050.00320.01
8.2.30.0070.00018.30
8.2.20.0030.00617.87
8.2.10.0080.00018.20
8.2.00.0000.00717.93
8.1.280.0040.01125.92
8.1.270.0080.00022.18
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00422.19
8.1.230.0100.00019.20
8.1.220.0080.00017.80
8.1.210.0050.00318.77
8.1.200.0030.00617.36
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0000.00918.66
8.1.160.0070.00021.94
8.1.150.0000.00718.89
8.1.140.0050.00217.45
8.1.130.0070.00017.81
8.1.120.0000.00717.35
8.1.110.0000.00717.43
8.1.100.0060.00317.32
8.1.90.0040.00417.50
8.1.80.0000.00717.34
8.1.70.0000.00717.48
8.1.60.0040.00417.66
8.1.50.0040.00417.64
8.1.40.0030.00617.62
8.1.30.0090.00017.71
8.1.20.0040.00417.68
8.1.10.0020.00517.55
8.1.00.0000.00717.46
8.0.300.0040.00418.77
8.0.290.0050.00317.30
8.0.280.0050.00218.52
8.0.270.0000.00717.37
8.0.260.0000.00617.19
8.0.250.0020.00516.98
8.0.240.0000.00717.10
8.0.230.0070.00017.13
8.0.220.0000.00716.94
8.0.210.0050.00316.99
8.0.200.0000.00617.04
8.0.190.0040.00416.91
8.0.180.0000.00716.96
8.0.170.0000.00816.96
8.0.160.0040.00417.00
8.0.150.0000.00816.84
8.0.140.0040.00316.96
8.0.130.0050.00013.45
8.0.120.0000.00716.85
8.0.110.0040.00416.99
8.0.100.0000.00716.85
8.0.90.0000.00716.85
8.0.80.0060.01016.88
8.0.70.0050.00317.00
8.0.60.0000.00716.83
8.0.50.0040.00416.96
8.0.30.0110.01117.35
8.0.20.0110.01017.40
8.0.10.0040.00417.18
8.0.00.0130.00517.00
7.4.330.0000.00615.03
7.4.320.0000.00616.47
7.4.300.0000.00716.59
7.4.290.0030.00316.69
7.4.280.0040.00416.59
7.4.270.0040.00416.60
7.4.260.0030.00316.65
7.4.250.0040.00416.48
7.4.240.0060.00216.61
7.4.230.0020.00516.57
7.4.220.0030.01316.58
7.4.210.0100.00716.77
7.4.200.0040.00416.77
7.4.160.0110.00616.58
7.4.150.0130.00517.40
7.4.140.0140.00717.86
7.4.130.0090.00816.69
7.4.120.0080.00816.56
7.4.110.0200.00416.46
7.4.100.0060.01216.74
7.4.90.0100.00716.37
7.4.80.0110.00519.39
7.4.70.0070.01116.66
7.4.60.0120.00616.67
7.4.50.0030.00316.61
7.4.40.0140.00716.50
7.4.30.0120.00316.59
7.4.00.0070.01014.88
7.3.330.0030.00313.30
7.3.320.0030.00313.32
7.3.310.0030.00316.45
7.3.300.0030.00316.43
7.3.290.0080.01016.52
7.3.280.0070.01016.50
7.3.270.0060.01117.40
7.3.260.0060.01316.51
7.3.250.0160.00516.54
7.3.240.0070.01016.44
7.3.230.0120.00616.47
7.3.210.0090.01216.55
7.3.200.0130.00319.39
7.3.190.0170.00316.56
7.3.180.0110.00416.40
7.3.170.0040.01816.48
7.3.160.0120.00316.50
7.2.330.0030.01316.81
7.2.320.0070.01016.88
7.2.310.0060.01716.47
7.2.300.0130.00316.55
7.2.290.0070.01716.78
7.2.60.0090.00616.74
7.2.00.0040.00819.45
7.1.200.0060.00615.77
7.1.100.0030.01018.08
7.1.70.0070.00317.19
7.1.60.0030.02119.57
7.1.50.0170.00717.07
7.1.00.0130.06322.25
7.0.200.0060.00316.84
7.0.140.0000.05721.96
7.0.60.0070.04719.85
7.0.50.0030.08317.91
7.0.40.0070.04319.96
7.0.30.0270.04320.11
7.0.20.0270.06020.07
7.0.10.0070.07720.22
7.0.00.0100.03720.07
5.6.280.0000.07721.08
5.6.210.0100.07720.62
5.6.200.0000.04318.14
5.6.190.0030.05320.62
5.6.180.0270.06720.56
5.6.170.0200.05320.71
5.6.160.0200.07720.50
5.6.150.0030.05018.18
5.6.140.0000.06318.14
5.6.130.0130.07718.13
5.6.120.0030.08721.15
5.6.110.0000.09020.97
5.6.100.0070.06721.14
5.6.90.0070.03720.97
5.6.80.0030.08320.48
5.5.350.0230.07720.41
5.5.340.0030.04317.95
5.5.330.0000.08720.43
5.5.320.0230.05020.37
5.5.310.0300.08020.30
5.5.300.0070.05718.08
5.5.290.0000.04317.96
5.5.280.0070.08320.80
5.5.270.0130.03320.78
5.5.260.0100.08320.73
5.5.250.0000.04720.78
5.5.240.0030.06020.16
5.4.450.0930.04719.66
5.4.440.0630.05319.46
5.4.430.0100.05719.53
5.4.420.0100.06019.21
5.4.410.0170.05719.02
5.4.400.0130.04718.77
5.4.390.0070.05718.59
5.4.380.0070.05718.57
5.4.370.0200.05318.80
5.4.360.0230.05018.73
5.4.350.0230.05718.81
5.4.340.0270.04718.81
5.4.320.0230.05018.84
5.4.310.0200.05018.75
5.4.300.0200.05018.63
5.4.290.0200.04718.59
5.4.280.0130.05718.62
5.4.270.0130.05718.57
5.4.260.0200.05018.57
5.4.250.0230.05018.78
5.4.240.0270.04718.62
5.4.230.0170.05318.73
5.4.220.0170.05718.48
5.4.210.0170.05718.51
5.4.200.0130.05716.67
5.4.190.0230.04718.73
5.4.180.0230.04718.80
5.4.170.0300.04318.44
5.4.160.0200.05318.77
5.4.150.0270.04718.76
5.4.140.0230.04716.31
5.4.130.0230.05016.34
5.4.120.0070.06016.21
5.4.110.0200.04716.22
5.4.100.0170.05316.37
5.4.90.0130.05316.35
5.4.80.0230.04716.42
5.4.70.0300.04016.32
5.4.60.0200.04716.30
5.4.50.0270.04016.42
5.4.40.0170.05316.18
5.4.30.0170.05016.24
5.4.20.0230.04716.28
5.4.10.0130.05716.31
5.4.00.0200.04715.78
5.3.290.0100.06314.62
5.3.280.0230.05014.63
5.3.270.0270.04314.62
5.3.260.0170.05714.66
5.3.250.0230.04714.64
5.3.240.0200.04714.56
5.3.230.0130.05714.53
5.3.220.0130.05314.46
5.3.210.0270.04314.46
5.3.200.0130.05714.56
5.3.190.0200.05014.47
5.3.180.0270.04314.60
5.3.170.0200.04714.55
5.3.160.0100.05714.54
5.3.150.0200.05014.57
5.3.140.0230.04714.48
5.3.130.0170.05314.54
5.3.120.0170.05714.45
5.3.110.0200.05014.63
5.3.100.0200.05013.94
5.3.90.0230.04714.01
5.3.80.0330.04314.12
5.3.70.0170.05313.96
5.3.60.0200.04714.05
5.3.50.0200.05013.89
5.3.40.0170.05014.03
5.3.30.0270.04013.83
5.3.20.0270.04313.60
5.3.10.0030.06013.69
5.3.00.0170.05013.59
5.2.170.0070.04711.18
5.2.160.0100.04311.13
5.2.150.0170.03711.20
5.2.140.0170.03711.28
5.2.130.0030.04711.16
5.2.120.0200.03711.05
5.2.110.0200.03311.10
5.2.100.0170.03711.07
5.2.90.0200.03311.08
5.2.80.0130.04311.07
5.2.70.0300.02311.05
5.2.60.0170.04011.11
5.2.50.0200.04010.97
5.2.40.0100.04010.93
5.2.30.0100.04010.92
5.2.20.0130.03711.00
5.2.10.0130.03710.92
5.2.00.0100.04010.78
5.1.60.0030.04010.06
5.1.50.0000.0439.97
5.1.40.0070.0379.93
5.1.30.0100.03710.39
5.1.20.0130.03310.41
5.1.10.0230.02310.20
5.1.00.0130.03310.05
5.0.50.0030.0338.59
5.0.40.0100.0238.40
5.0.30.0100.0408.28
5.0.20.0000.0378.24
5.0.10.0070.0278.36
5.0.00.0030.0438.27
4.4.90.0030.0235.90
4.4.80.0030.0235.82
4.4.70.0100.0205.87
4.4.60.0000.0275.89
4.4.50.0000.0275.91
4.4.40.0170.0305.94
4.4.30.0100.0205.89
4.4.20.0100.0205.89
4.4.10.0030.0235.98
4.4.00.0100.0305.91
4.3.110.0030.0275.88
4.3.100.0030.0275.86
4.3.90.0030.0275.84
4.3.80.0030.0375.78
4.3.70.0030.0235.93
4.3.60.0130.0175.80
4.3.50.0070.0205.80
4.3.40.0070.0335.85
4.3.30.0030.0205.41
4.3.20.0030.0235.41
4.3.10.0100.0175.41
4.3.00.0130.0237.13

preferences:
18.24 ms | 401 KiB | 5 Q