3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = '/some/path/'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { if (substr( $path, -1 ) == '/') $path = substr( $path, 0, -1 ); } $end = microtime(true); echo "<br>\n" . $end - $start; $path = '/some/path'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { if (substr( $path, -1 ) == '/') $path = substr( $path, 0, -1 ); } $end = microtime(true); echo "<br>\n" . $end - $start; $path = '/some/path/'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { $path = rtrim($path, '/'); } $end = microtime(true); echo "<br>\n" . $end - $start; $path = '/some/path'; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { $path = rtrim($path, '/'); } $end = microtime(true); echo "<br>\n" . $end - $start;

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.0150.00714.89
7.4.00.0100.01014.94
7.3.130.0070.01514.77
7.3.120.0100.01114.80
7.3.110.0050.01514.72
7.3.100.0060.01114.85
7.3.90.0060.00814.72
7.3.80.0050.00614.74
7.3.70.0050.01114.90
7.3.60.0020.01414.81
7.3.50.0050.01214.97
7.3.40.0050.01214.87
7.3.30.0090.00714.81
7.3.20.0020.01616.76
7.3.10.0110.00516.46
7.3.00.0090.00716.60
7.2.260.0030.01514.86
7.2.250.0030.01515.12
7.2.240.0050.01315.10
7.2.230.0020.01515.26
7.2.220.0040.01415.00
7.2.210.0030.01415.08
7.2.200.0020.01414.94
7.2.190.0060.00715.07
7.2.180.0080.00815.01
7.2.170.0050.01114.96
7.2.160.0000.01714.98
7.2.150.0040.01116.83
7.2.140.0030.00916.75
7.2.130.0100.01016.82
7.2.120.0090.00916.99
7.2.110.0060.00916.99
7.2.100.0040.01516.83
7.2.90.0000.01417.09
7.2.80.0120.00616.86
7.2.70.0030.01017.04
7.2.60.0070.01016.69
7.2.50.0070.01016.97
7.2.40.0070.01016.81
7.2.30.0060.01316.98
7.2.20.0030.01016.69
7.2.10.0000.01216.79
7.2.00.0030.01018.20
7.1.330.0050.01615.77
7.1.320.0030.01715.88
7.1.310.0080.01115.79
7.1.300.0020.01215.76
7.1.290.0050.01515.66
7.1.280.0030.01715.69
7.1.270.0050.01515.88
7.1.260.0030.01515.80
7.1.250.0030.01615.84
7.1.240.0120.00615.91
7.1.230.0000.01616.03
7.1.220.0070.00715.64
7.1.210.0040.01515.62
7.1.200.0060.01315.61
7.1.190.0030.01015.86
7.1.180.0000.01315.82
7.1.170.0040.01415.88
7.1.160.0100.00615.58
7.1.150.0040.01115.79
7.1.140.0030.01715.83
7.1.130.0000.02015.97
7.1.120.0000.01715.87
7.1.110.0090.00915.80
7.1.100.0130.00615.80
7.1.90.0060.01015.86
7.1.80.0070.01415.96
7.1.70.0030.01216.62
7.1.60.0030.01217.55
7.1.50.0040.01716.48
7.1.40.0060.01315.95
7.1.30.0030.01415.85
7.1.20.0120.00915.95
7.1.10.0030.01715.67
7.1.00.0050.04619.08
7.0.330.0070.01415.43
7.0.320.0000.01515.49
7.0.310.0030.01315.54
7.0.300.0030.01915.22
7.0.290.0060.01015.61
7.0.280.0090.00915.45
7.0.270.0030.01315.48
7.0.260.0070.01315.20
7.0.250.0070.01415.48
7.0.240.0060.01315.50
7.0.230.0060.00615.45
7.0.220.0000.01815.41
7.0.210.0060.01215.39
7.0.200.0060.01415.96
7.0.190.0070.01015.33
7.0.180.0090.00615.45
7.0.170.0090.01015.16
7.0.160.0060.01315.61
7.0.150.0000.01515.31
7.0.140.0000.04718.73
7.0.130.0030.01715.63
7.0.120.0060.01215.19
7.0.110.0080.00815.51
7.0.100.0030.00915.44
7.0.90.0060.01515.21
7.0.80.0000.02015.32
7.0.70.0030.01515.25
7.0.60.0030.03217.79
7.0.50.0040.03416.72
7.0.40.0030.02915.69
7.0.30.0130.04315.48
7.0.20.0110.03815.52
7.0.10.0050.05015.58
7.0.00.0020.05215.62
5.6.400.0070.02114.28
5.6.390.0070.02014.40
5.6.380.0000.02514.32
5.6.370.0030.02314.40
5.6.360.0120.01614.58
5.6.350.0040.01814.34
5.6.340.0100.01914.11
5.6.330.0000.02414.62
5.6.320.0030.02614.55
5.6.310.0070.02414.32
5.6.300.0100.01914.45
5.6.290.0070.02114.13
5.6.280.0080.05117.80
5.6.270.0030.02314.30
5.6.260.0030.02314.65
5.6.250.0030.02414.38
5.6.240.0070.02314.43
5.6.230.0030.02314.18
5.6.220.0030.02614.50
5.6.210.0080.04417.48
5.6.200.0070.04316.31
5.6.190.0100.05116.24
5.6.180.0100.05516.18
5.6.170.0130.04316.24
5.6.160.0030.04016.14
5.6.150.0100.05316.18
5.6.140.0050.05516.35
5.6.130.0080.05216.14
5.6.120.0020.05916.20
5.6.110.0070.03516.21
5.6.100.0080.03716.23
5.6.90.0050.05716.32
5.6.80.0050.03215.79
5.6.70.0070.05315.80
5.6.60.0090.05315.84
5.6.50.0080.05515.95
5.6.40.0100.04915.94
5.6.30.0100.03515.96
5.6.20.0000.04915.94
5.6.10.0080.04215.81
5.6.00.0070.04215.91
5.5.380.0120.01514.53
5.5.370.0030.02014.46
5.5.360.0030.02714.38
5.5.350.0200.05217.24
5.5.340.0000.05316.32
5.5.330.0080.05516.06
5.5.320.0060.05816.30
5.5.310.0090.05216.21
5.5.300.0000.04916.12
5.5.290.0020.04816.13
5.5.280.0050.05816.23
5.5.270.0050.05816.21
5.5.260.0070.05516.03
5.5.250.0050.04115.87
5.5.240.0130.05015.90
5.5.230.0100.05015.66
5.5.220.0050.04215.78
5.5.210.0050.05315.64
5.5.200.0050.05815.75
5.5.190.0070.05415.57
5.5.180.0070.05515.75
5.5.170.0070.02214.38
5.5.160.0030.03815.73
5.5.150.0100.04215.70
5.5.140.0100.05115.88
5.5.130.0060.05315.70
5.5.120.0120.05115.79
5.5.110.0080.04515.75
5.5.100.0050.04915.76
5.5.90.0030.05315.71
5.5.80.0070.04015.82
5.5.70.0100.03715.62
5.5.60.0080.05015.69
5.5.50.0050.04415.73
5.5.40.0080.03115.63
5.5.30.0080.05115.82
5.5.20.0050.05315.68
5.5.10.0050.05415.73
5.5.00.0020.03715.75
5.4.450.0120.05015.20
5.4.440.0120.05015.22
5.4.430.0030.05715.17
5.4.420.0070.03715.22
5.4.410.0080.05315.08
5.4.400.0100.04715.06
5.4.390.0050.05415.07
5.4.380.0080.04814.92
5.4.370.0060.04214.91
5.4.360.0080.05514.98
5.4.350.0100.04515.00
5.4.340.0080.03315.10
5.4.330.0030.02311.17
5.4.320.0050.04315.14
5.4.310.0050.05415.06
5.4.300.0020.05315.05
5.4.290.0070.05315.05
5.4.280.0080.05415.01
5.4.270.0030.04614.99
5.4.260.0050.05515.01
5.4.250.0030.05614.97
5.4.240.0030.04915.12
5.4.230.0020.05315.04
5.4.220.0050.03215.01
5.4.210.0050.05115.00
5.4.200.0080.02814.95
5.4.190.0120.04815.00
5.4.180.0070.04615.07
5.4.170.0090.04614.99
5.4.160.0050.05314.93
5.4.150.0030.05315.01
5.4.140.0030.03913.64
5.4.130.0080.04813.63
5.4.120.0020.05613.67
5.4.110.0100.04613.76
5.4.100.0060.05113.69
5.4.90.0090.03913.67
5.4.80.0070.04413.65
5.4.70.0030.04113.75
5.4.60.0050.03513.61
5.4.50.0030.04313.80
5.4.40.0020.03813.64
5.4.30.0080.04813.67
5.4.20.0030.04013.68
5.4.10.0030.05013.74
5.4.00.0050.05613.44
5.3.290.0100.03312.81
5.3.280.0020.05812.79
5.3.270.0030.06112.70
5.3.260.0070.05812.79
5.3.250.0050.05112.78
5.3.240.0070.05312.77
5.3.230.0050.05312.79
5.3.220.0020.04212.75
5.3.210.0020.06012.77
5.3.200.0050.04112.75
5.3.190.0030.04512.78
5.3.180.0050.05612.74
5.3.170.0080.05212.82
5.3.160.0050.05712.76
5.3.150.0030.05312.67
5.3.140.0020.05012.77
5.3.130.0050.04412.74
5.3.120.0050.04312.76
5.3.110.0030.05912.76
5.3.100.0020.05512.50
5.3.90.0070.04712.42
5.3.80.0080.05412.39
5.3.70.0080.05012.55
5.3.60.0050.03312.38
5.3.50.0080.05212.44
5.3.40.0020.04412.47
5.3.30.0020.05712.34
5.3.20.0050.05512.24
5.3.10.0050.05012.29
5.3.00.0050.05512.21
5.2.170.0100.07311.11
5.2.160.0100.07311.12
5.2.150.0070.07711.30
5.2.140.0030.08011.14
5.2.130.0070.08011.11
5.2.120.0070.07311.10
5.2.110.0100.05311.10
5.2.100.0100.07311.01
5.2.90.0030.07011.11
5.2.80.0000.07310.93
5.2.70.0070.06010.93
5.2.60.0100.07011.21
5.2.50.0070.07311.04
5.2.40.0030.07710.99
5.2.30.0030.05710.98
5.2.20.0070.07310.94
5.2.10.0000.04310.96
5.2.00.0100.07010.77
5.1.60.0070.0679.99
5.1.50.0030.03710.08
5.1.40.0070.06310.06
5.1.30.0100.05710.30
5.1.20.0070.03310.31
5.1.10.0000.07310.12
5.1.00.0030.04710.14
5.0.50.0070.0678.65
5.0.40.0000.0378.51
5.0.30.0000.0678.30
5.0.20.0100.0408.18
5.0.10.0000.0378.10
5.0.00.0030.0878.17
4.4.90.0030.0577.73
4.4.80.0030.0477.73
4.4.70.0000.0337.73
4.4.60.0000.0407.73
4.4.50.0000.0407.73
4.4.40.0030.0707.73
4.4.30.0070.0237.73
4.4.20.0030.0577.73
4.4.10.0070.0537.73
4.4.00.0030.0777.73
4.3.110.0030.0377.73
4.3.100.0030.0537.73
4.3.90.0070.0537.73
4.3.80.0000.0507.73
4.3.70.0030.0277.73
4.3.60.0030.0407.73
4.3.50.0100.0407.73
4.3.40.0070.0607.73
4.3.30.0000.0377.73
4.3.20.0030.0577.73
4.3.10.0000.0577.73
4.3.00.0030.0507.73

preferences:
35.31 ms | 400 KiB | 5 Q