3v4l.org

run code in 300+ PHP versions simultaneously
<?php function trimdata($str, $start = 0, $len = 255, $sep = '|') { if($start == 0 && strlen($str) <= $len) return $str; if(strlen($str) - $start <= $len) return substr($str, $start, $len); if($start >= 0) { $str = substr($str, $start, $len + 1); //In-case the last record is complete $pos = strrpos($str, $sep, -1); $str = substr($str, $start, $pos); } else { } return $str; } $str = "0|1|2|3|4|5|6|7|8|9|0"; var_dump($ret = trimdata($str, 0, 10), strlen($ret));

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.0090.01216.88
8.3.50.0230.01016.35
8.3.40.0090.00618.84
8.3.30.0040.01118.63
8.3.20.0000.00918.64
8.3.10.0040.00420.41
8.3.00.0030.00719.25
8.2.180.0110.01118.41
8.2.170.0080.00819.01
8.2.160.0180.00422.96
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.09
8.2.110.0030.00721.12
8.2.100.0040.00817.91
8.2.90.0050.00519.36
8.2.80.0000.00719.45
8.2.70.0030.00517.63
8.2.60.0050.00318.04
8.2.50.0000.01118.07
8.2.40.0060.00318.22
8.2.30.0050.00318.13
8.2.20.0000.00817.66
8.2.10.0040.00417.67
8.2.00.0030.00517.70
8.1.280.0140.00425.92
8.1.270.0140.00024.66
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0030.00622.42
8.1.230.0110.00021.04
8.1.220.0080.00017.74
8.1.210.0070.00418.96
8.1.200.0030.00617.23
8.1.190.0050.00317.53
8.1.180.0040.00418.10
8.1.170.0040.00418.81
8.1.160.0000.00718.81
8.1.150.0040.00418.56
8.1.140.0030.00517.58
8.1.130.0030.00317.88
8.1.120.0040.00417.52
8.1.110.0030.00517.48
8.1.100.0070.00017.43
8.1.90.0080.00017.48
8.1.80.0070.00017.35
8.1.70.0000.00717.50
8.1.60.0030.00617.48
8.1.50.0000.00917.48
8.1.40.0040.00417.53
8.1.30.0040.00417.61
8.1.20.0000.00717.52
8.1.10.0000.00817.39
8.1.00.0050.00317.46
8.0.300.0020.00519.86
8.0.290.0000.00716.63
8.0.280.0070.00018.40
8.0.270.0000.00717.27
8.0.260.0030.00316.80
8.0.250.0040.00416.88
8.0.240.0000.00716.96
8.0.230.0040.00216.86
8.0.220.0030.00316.85
8.0.210.0040.00416.90
8.0.200.0040.00416.86
8.0.190.0000.00816.89
8.0.180.0030.00516.90
8.0.170.0000.00716.91
8.0.160.0030.00516.95
8.0.150.0000.00916.83
8.0.140.0000.00716.91
8.0.130.0000.00613.38
8.0.120.0040.00416.77
8.0.110.0070.00016.79
8.0.100.0030.00316.77
8.0.90.0000.00716.89
8.0.80.0150.00016.87
8.0.70.0000.00716.86
8.0.60.0050.00316.91
8.0.50.0000.00716.77
8.0.30.0050.01417.12
8.0.20.0110.01017.31
8.0.10.0070.00016.86
8.0.00.0090.01116.89
7.4.330.0020.00212.95
7.4.320.0000.00616.64
7.4.300.0030.00316.60
7.4.290.0030.00616.45
7.4.280.0030.00516.55
7.4.270.0000.00816.57
7.4.260.0050.00013.31
7.4.250.0050.00316.52
7.4.240.0000.00716.63
7.4.230.0000.00716.63
7.4.220.0050.01416.49
7.4.210.0090.00816.54
7.4.200.0000.00716.43
7.4.190.0030.00316.38
7.4.160.0000.01516.42
7.4.150.0140.00416.63
7.4.140.0140.00816.56
7.4.130.0090.01316.55
7.4.120.0070.01016.52
7.4.110.0030.01316.60
7.4.100.0060.01516.59
7.4.90.0090.00916.63
7.4.80.0130.01019.39
7.4.70.0120.00616.47
7.4.60.0100.00616.39
7.4.50.0070.00016.65
7.4.40.0100.00616.38
7.4.30.0100.00716.61
7.4.00.0070.00415.02
7.3.330.0030.00313.25
7.3.320.0000.00513.20
7.3.310.0070.00016.20
7.3.300.0030.00316.36
7.3.290.0110.00316.39
7.3.280.0090.00816.36
7.3.270.0030.01516.30
7.3.260.0130.00916.68
7.3.250.0100.00916.55
7.3.240.0040.01316.48
7.3.230.0130.00316.60
7.3.210.0100.00716.45
7.3.200.0090.00616.40
7.3.190.0060.01316.38
7.3.180.0100.00616.59
7.3.170.0110.00616.40
7.3.160.0080.01416.39
7.3.120.0090.00614.85
7.3.00.0060.00616.73
7.2.330.0130.00716.64
7.2.320.0070.01316.64
7.2.310.0100.01316.70
7.2.300.0100.00716.70
7.2.290.0060.01116.82
7.2.130.0030.01216.83
7.2.120.0080.00817.07
7.2.110.0070.00716.88
7.2.100.0030.00916.63
7.2.90.0090.00016.91
7.2.80.0120.00316.98
7.2.70.0090.00317.05
7.2.60.0040.00816.91
7.2.50.0060.00616.94
7.2.40.0000.01016.78
7.2.30.0040.00717.02
7.2.20.0040.00816.88
7.2.10.0060.00616.93
7.2.00.0070.00818.29
7.1.250.0030.00815.71
7.1.240.0030.00615.83
7.1.230.0030.01015.86
7.1.220.0050.00315.86
7.1.210.0030.00715.93
7.1.200.0000.01415.87
7.1.190.0040.01115.79
7.1.180.0000.01215.67
7.1.170.0070.00315.82
7.1.160.0060.00815.80
7.1.150.0100.00315.71
7.1.140.0080.00315.86
7.1.130.0000.01315.51
7.1.120.0030.00915.65
7.1.110.0040.00415.66
7.1.100.0000.01015.88
7.1.90.0090.00315.80
7.1.80.0030.00715.96
7.1.70.0020.00916.58
7.1.60.0050.01417.69
7.1.50.0000.01216.32
7.1.40.0030.00615.75
7.1.30.0100.00015.55
7.1.20.0060.00315.83
7.1.10.0070.00715.78
7.1.00.0020.03918.96
7.0.330.0040.00415.11
7.0.320.0000.01115.26
7.0.310.0070.00315.43
7.0.300.0060.00315.14
7.0.290.0000.01015.34
7.0.280.0060.00315.25
7.0.270.0070.00715.36
7.0.260.0000.00815.18
7.0.250.0000.01315.48
7.0.240.0000.01215.48
7.0.230.0060.00315.27
7.0.220.0100.00015.48
7.0.210.0060.00615.43
7.0.200.0230.00715.00
7.0.190.0080.00015.43
7.0.180.0030.01015.28
7.0.170.0030.00915.26
7.0.160.0000.01015.43
7.0.150.0070.00415.48
7.0.140.0090.03518.75
7.0.130.0030.00715.36
7.0.120.0050.03818.72
7.0.110.0000.00915.29
7.0.100.0040.00815.32
7.0.90.0120.00015.59
7.0.80.0070.00715.48
7.0.70.0030.00915.43
7.0.60.0120.02917.65
7.0.50.0070.02716.54
7.0.40.0080.02316.77
7.0.30.0090.04216.77
7.0.20.0030.04816.75
7.0.10.0030.05016.83
7.0.00.0070.03716.70
5.6.380.0030.00614.21
5.6.370.0080.00414.12
5.6.360.0000.00913.99
5.6.350.0030.00714.35
5.6.340.0070.00714.23
5.6.330.0040.00814.27
5.6.320.0040.00414.34
5.6.310.0030.00914.52
5.6.300.0100.00314.53
5.6.290.0040.00714.12
5.6.280.0040.04117.55
5.6.270.0080.00014.25
5.6.260.0000.01314.10
5.6.250.0070.00314.11
5.6.240.0070.00314.22
5.6.230.0030.00714.59
5.6.220.0000.01414.16
5.6.210.0080.04217.61
5.6.200.0080.03316.24
5.6.190.0030.03517.46
5.6.180.0050.02517.43
5.6.170.0070.04717.35
5.6.160.0030.02917.26
5.6.150.0070.02617.13
5.6.140.0040.02617.08
5.6.130.0120.01817.23
5.6.120.0100.02017.37
5.6.110.0030.02417.29
5.6.100.0080.01917.25
5.6.90.0020.03317.35
5.6.80.0030.02516.87
5.6.70.0080.02017.05
5.6.60.0050.02316.88
5.6.50.0030.02516.99
5.6.40.0070.02216.94
5.6.30.0030.02517.04
5.6.20.0100.01717.02
5.6.10.0000.02716.89
5.6.00.0030.02516.97
5.5.380.0050.00510.90
5.5.370.0060.00610.90
5.5.360.0110.00011.24
5.5.350.0030.01715.69
5.5.340.0070.03714.43
5.5.330.0090.03715.60
5.5.320.0080.03915.65
5.5.310.0070.04315.72
5.5.300.0010.02815.51
5.5.290.0050.02115.59
5.5.280.0000.03115.53
5.5.270.0050.02115.59
5.5.260.0020.02315.49
5.5.250.0080.02015.57
5.5.240.0100.02215.28
5.5.230.0040.02215.30
5.5.220.0050.02215.12
5.5.210.0060.02015.13
5.5.200.0020.02315.22
5.5.190.0040.02215.35
5.5.180.0040.02315.22
5.5.170.0070.00010.92
5.5.160.0020.02315.10
5.5.150.0070.02715.35
5.5.140.0040.02215.33
5.5.130.0020.02715.24
5.5.120.0020.03115.40
5.5.110.0060.02915.27
5.5.100.0070.02715.07
5.5.90.0020.03615.14
5.5.80.0000.03415.07
5.5.70.0030.03115.13
5.5.60.0070.02915.25
5.5.50.0090.04215.05
5.5.40.0020.03015.21
5.5.30.0020.03215.21
5.5.20.0050.04315.33
5.5.10.0070.04915.20
5.5.00.0050.02915.27
5.4.450.0030.02515.04
5.4.440.0040.02115.28
5.4.430.0050.02115.04
5.4.420.0020.02315.30
5.4.410.0090.01715.16
5.4.400.0030.02115.08
5.4.390.0050.02114.87
5.4.380.0070.01814.88
5.4.370.0040.02215.05
5.4.360.0050.02015.02
5.4.350.0030.02215.01
5.4.340.0030.02215.07
5.4.330.0040.00710.90
5.4.320.0110.01314.94
5.4.310.0050.01815.07
5.4.300.0040.02015.02
5.4.290.0000.02514.87
5.4.280.0030.02115.05
5.4.270.0040.04014.97
5.4.260.0060.04015.18
5.4.250.0060.03515.01
5.4.240.0030.02615.10
5.4.230.0000.02415.07
5.4.220.0050.04015.02
5.4.210.0050.02014.97
5.4.200.0050.02815.04
5.4.190.0030.03714.97
5.4.180.0100.02714.88
5.4.170.0040.04315.03
5.4.160.0080.02015.11
5.4.150.0060.01814.87
5.4.140.0030.03013.70
5.4.130.0030.02213.65
5.4.120.0060.02213.67
5.4.110.0060.02213.88
5.4.100.0070.03713.67
5.4.90.0060.01713.64
5.4.80.0030.02113.65
5.4.70.0060.03113.79
5.4.60.0080.02113.71
5.4.50.0050.03913.65
5.4.40.0090.02213.76
5.4.30.0020.03913.67
5.4.20.0050.03813.57
5.4.10.0020.04313.58
5.4.00.0000.03113.44
5.3.290.0010.02112.86
5.3.280.0020.04212.77
5.3.270.0070.04012.76
5.3.260.0080.01812.78
5.3.250.0000.02412.71
5.3.240.0050.02112.75
5.3.230.0050.03012.82
5.3.220.0050.02212.73
5.3.210.0080.01812.68
5.3.200.0060.03112.75
5.3.190.0030.02112.69
5.3.180.0020.02212.74
5.3.170.0050.01812.74
5.3.160.0120.02012.77
5.3.150.0070.02712.75
5.3.140.0030.03112.75
5.3.130.0060.02012.72
5.3.120.0050.03012.73
5.3.110.0070.01812.73
5.3.100.0050.02312.50
5.3.90.0070.02812.46
5.3.80.0060.03712.43
5.3.70.0000.02512.48
5.3.60.0020.04212.49
5.3.50.0070.02812.45
5.3.40.0020.04112.45
5.3.30.0050.02412.43
5.3.20.0030.03912.32
5.3.10.0040.03712.30
5.3.00.0080.02612.35
5.2.170.0020.03211.02
5.2.160.0020.02611.03
5.2.150.0000.02311.03
5.2.140.0030.03510.99
5.2.130.0020.03311.02
5.2.120.0050.03211.00
5.2.110.0060.03010.97
5.2.100.0050.02511.01
5.2.90.0030.03511.04
5.2.80.0040.03511.01
5.2.70.0020.02710.97
5.2.60.0030.01610.99
5.2.50.0020.03510.96
5.2.40.0020.02811.02
5.2.30.0030.03110.96
5.2.20.0050.02810.95
5.2.10.0010.02810.90
5.2.00.0050.01610.88
5.1.60.0080.02310.52
5.1.50.0030.02310.43
5.1.40.0020.02110.42
5.1.30.0050.03010.65
5.1.20.0050.02510.62
5.1.10.0020.01510.48
5.1.00.0030.01610.51
5.0.50.0000.0269.80
5.0.40.0010.0189.65
5.0.30.0020.0229.52
5.0.20.0050.0209.53
5.0.10.0050.0209.57
5.0.00.0080.0179.54
4.4.90.0050.0158.77
4.4.80.0010.0198.77
4.4.70.0000.0218.77
4.4.60.0020.0108.77
4.4.50.0000.0208.77
4.4.40.0030.0228.77
4.4.30.0010.0238.77
4.4.20.0020.0108.77
4.4.10.0010.0188.77
4.4.00.0030.0248.77
4.3.110.0030.0148.77
4.3.100.0000.0218.77
4.3.90.0050.0208.77
4.3.80.0000.0298.77
4.3.70.0030.0128.77
4.3.60.0020.0128.77
4.3.50.0050.0078.77
4.3.40.0000.0248.77
4.3.30.0040.0088.77
4.3.20.0020.0128.77
4.3.10.0000.0158.77
4.3.00.0030.0108.77

preferences:
43.36 ms | 401 KiB | 5 Q