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-$start); } else { } return $str; } $str = "0|1|27|36|4|5|6|7|8|9|0"; var_dump($ret = trimdata($str, 1, 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.40.0090.00918.67
8.3.30.0100.01020.20
8.3.20.0030.00618.78
8.3.10.0030.00521.13
8.3.00.0050.00222.58
8.2.170.0100.00722.96
8.2.160.0100.00320.11
8.2.150.0040.00424.18
8.2.140.0030.00724.66
8.2.130.0000.00826.16
8.2.120.0060.00319.37
8.2.110.0030.00719.21
8.2.100.0080.00317.72
8.2.90.0030.00519.19
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0040.00418.02
8.2.50.0040.00418.07
8.2.40.0030.00518.07
8.2.30.0040.00419.57
8.2.20.0030.00517.63
8.2.10.0050.00317.77
8.2.00.0030.00617.75
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0080.00023.91
8.1.230.0050.00521.03
8.1.220.0030.00518.77
8.1.210.0080.00019.14
8.1.200.0100.00017.23
8.1.190.0040.00417.40
8.1.180.0030.00718.10
8.1.170.0030.00518.59
8.1.160.0000.00718.90
8.1.150.0070.00018.57
8.1.140.0040.00417.51
8.1.130.0030.00317.85
8.1.120.0000.00717.38
8.1.110.0050.00217.43
8.1.100.0050.00217.41
8.1.90.0000.00817.49
8.1.80.0040.00417.52
8.1.70.0050.00517.50
8.1.60.0040.00417.64
8.1.50.0050.00317.49
8.1.40.0000.00817.45
8.1.30.0000.00717.56
8.1.20.0060.00317.68
8.1.10.0030.00617.41
8.1.00.0030.00617.51
8.0.300.0000.00719.89
8.0.290.0000.00817.18
8.0.280.0030.00318.38
8.0.270.0030.00317.15
8.0.260.0080.00016.74
8.0.250.0030.00616.95
8.0.240.0000.01116.99
8.0.230.0040.00416.99
8.0.220.0060.00016.85
8.0.210.0070.00016.97
8.0.200.0000.00716.93
8.0.190.0040.00416.88
8.0.180.0040.00416.90
8.0.170.0000.00816.84
8.0.160.0000.00716.92
8.0.150.0070.00016.90
8.0.140.0000.00716.89
8.0.130.0030.00313.31
8.0.120.0050.00216.84
8.0.110.0000.00716.89
8.0.100.0050.00216.90
8.0.90.0040.00416.78
8.0.80.0090.00616.82
8.0.70.0000.00716.97
8.0.60.0030.00516.82
8.0.50.0030.00316.72
8.0.30.0110.00816.99
8.0.20.0130.01017.40
8.0.10.0040.00417.10
8.0.00.0130.00516.75
7.4.330.0020.00216.66
7.4.320.0040.00416.54
7.4.300.0040.00416.58
7.4.290.0000.00616.53
7.4.280.0070.00016.67
7.4.270.0040.00416.43
7.4.260.0030.00313.31
7.4.250.0040.00416.35
7.4.240.0020.00516.52
7.4.230.0030.00316.36
7.4.220.0140.00716.60
7.4.210.0040.01116.65
7.4.200.0030.00316.69
7.4.190.0000.00716.52
7.4.160.0100.01316.49
7.4.150.0070.01117.40
7.4.140.0080.01017.86
7.4.130.0070.01016.60
7.4.120.0110.00616.68
7.4.110.0070.01016.33
7.4.100.0120.00616.50
7.4.90.0150.00616.60
7.4.80.0150.00619.39
7.4.70.0120.00916.52
7.4.60.0090.01216.51
7.4.50.0040.00416.30
7.4.40.0040.01422.77
7.4.30.0040.01816.72
7.4.00.0000.01614.88
7.3.330.0000.00513.21
7.3.320.0000.00713.19
7.3.310.0040.00416.31
7.3.300.0030.00316.42
7.3.290.0130.00616.41
7.3.280.0090.00816.40
7.3.270.0110.00617.40
7.3.260.0140.00618.24
7.3.250.0120.00816.38
7.3.240.0060.01216.69
7.3.230.0140.00316.69
7.3.210.0160.00016.39
7.3.200.0130.00319.39
7.3.190.0110.00516.60
7.3.180.0060.01516.23
7.3.170.0180.00316.65
7.3.160.0160.00016.32
7.3.120.0080.00614.93
7.3.110.0070.01114.93
7.3.100.0120.00314.78
7.3.90.0030.00714.88
7.3.80.0060.00714.58
7.3.70.0090.00614.56
7.3.60.0070.00614.81
7.3.50.0040.01114.68
7.3.40.0030.01314.86
7.3.30.0070.00714.77
7.3.20.0090.00316.66
7.3.10.0060.01016.73
7.3.00.0020.00716.62
7.2.330.0060.01216.58
7.2.320.0090.00916.80
7.2.310.0130.00316.68
7.2.300.0130.00316.75
7.2.290.0090.01216.47
7.2.240.0030.01515.27
7.2.230.0000.01214.98
7.2.220.0000.00914.96
7.2.210.0030.01315.04
7.2.200.0090.00615.18
7.2.190.0060.01015.16
7.2.180.0030.01215.07
7.2.170.0030.01314.83
7.2.160.0060.00915.21
7.2.150.0070.00716.65
7.2.140.0070.00316.98
7.2.130.0020.01216.91
7.2.120.0080.00516.96
7.2.110.0020.01016.79
7.2.100.0100.00617.01
7.2.90.0020.01016.82
7.2.80.0050.00816.81
7.2.70.0040.00716.87
7.2.60.0060.00616.83
7.2.50.0030.01016.83
7.2.40.0040.00816.96
7.2.30.0000.00916.91
7.2.20.0040.00916.91
7.2.10.0070.00716.80
7.2.00.0070.00516.79
7.1.330.0030.01015.76
7.1.320.0000.01015.74
7.1.310.0050.00515.55
7.1.300.0080.00415.71
7.1.290.0110.00315.51
7.1.280.0030.00915.79
7.1.270.0110.00415.79
7.1.260.0060.00815.80
7.1.250.0030.01015.75
7.1.240.0060.00315.77
7.1.230.0090.00615.80
7.1.220.0070.00716.01
7.1.210.0130.00315.75
7.1.200.0080.00815.65
7.1.190.0030.01015.82
7.1.180.0000.01315.77
7.1.170.0130.00015.70
7.1.160.0130.00015.89
7.1.150.0030.00615.70
7.1.140.0090.00615.80
7.1.130.0000.01515.71
7.1.120.0080.00415.88
7.1.110.0030.01015.88
7.1.100.0030.01015.81
7.1.90.0000.01415.78
7.1.80.0070.00715.70
7.1.70.0030.00516.29
7.1.60.0070.01217.55
7.1.50.0050.01216.39
7.1.40.0060.00615.61
7.1.30.0000.00715.92
7.1.20.0000.01515.82
7.1.10.0000.00915.45
7.1.00.0050.03519.15
7.0.330.0000.01115.38
7.0.320.0100.00315.16
7.0.310.0040.00415.54
7.0.300.0030.00915.58
7.0.290.0000.00815.42
7.0.280.0000.00915.05
7.0.270.0090.00615.30
7.0.260.0000.01215.20
7.0.250.0080.00415.19
7.0.240.0030.00915.27
7.0.230.0050.00215.43
7.0.220.0030.00715.09
7.0.210.0000.01314.97
7.0.200.0040.00516.05
7.0.190.0040.00715.40
7.0.180.0000.01115.21
7.0.170.0060.00915.11
7.0.160.0090.00315.38
7.0.150.0120.00015.42
7.0.140.0050.03918.77
7.0.130.0000.00715.42
7.0.120.0070.00715.15
7.0.110.0100.00015.43
7.0.100.0050.03517.66
7.0.90.0060.04717.67
7.0.80.0050.04717.65
7.0.70.0120.04417.52
7.0.60.0030.04817.73
7.0.50.0090.02617.90
7.0.40.0050.04616.77
7.0.30.0100.04316.66
7.0.20.0090.04416.81
7.0.10.0060.04216.71
7.0.00.0080.04516.78
5.6.380.0060.00314.29
5.6.370.0070.00714.40
5.6.360.0090.00914.27
5.6.350.0060.00914.43
5.6.340.0060.00314.26
5.6.330.0040.00413.61
5.6.320.0030.01213.95
5.6.310.0030.01314.59
5.6.300.0000.01114.33
5.6.290.0030.00614.50
5.6.280.0080.03817.40
5.6.270.0140.00014.07
5.6.260.0060.00314.23
5.6.250.0050.03217.57
5.6.240.0090.04117.23
5.6.230.0070.02717.25
5.6.220.0050.04717.36
5.6.210.0050.02917.59
5.6.200.0080.04017.68
5.6.190.0030.04517.47
5.6.180.0050.05017.51
5.6.170.0070.04717.72
5.6.160.0100.04117.53
5.6.150.0070.03317.59
5.6.140.0070.04617.49
5.6.130.0100.03117.57
5.6.120.0050.03717.52
5.6.110.0100.04217.53
5.6.100.0120.04017.71
5.6.90.0030.04017.55
5.6.80.0080.04317.29
5.6.70.0100.02317.30
5.6.60.0050.03517.41
5.6.50.0070.02217.34
5.6.40.0130.04017.24
5.6.30.0120.03317.21
5.6.20.0110.03717.29
5.6.10.0020.02917.14
5.6.00.0060.04017.26
5.5.380.0060.04615.71
5.5.370.0080.02615.71
5.5.360.0050.04515.88
5.5.350.0000.05315.80
5.5.340.0080.03715.98
5.5.330.0140.03516.12
5.5.320.0080.04215.95
5.5.310.0040.03316.02
5.5.300.0140.03315.94
5.5.290.0040.03515.93
5.5.280.0050.04316.01
5.5.270.0030.02916.04
5.5.260.0090.03816.00
5.5.250.0100.03815.82
5.5.240.0130.02515.68
5.5.230.0020.02815.47
5.5.220.0020.03815.58
5.5.210.0110.03515.68
5.5.200.0050.04115.66
5.5.190.0100.02215.62
5.5.180.0130.03515.54
5.5.170.0060.00311.05
5.5.160.0080.04115.44
5.5.150.0020.04615.54
5.5.140.0130.03515.55
5.5.130.0080.04015.44
5.5.120.0030.03515.64
5.5.110.0050.03615.45
5.5.100.0060.04315.46
5.5.90.0050.02315.48
5.5.80.0060.02115.38
5.5.70.0010.02615.57
5.5.60.0010.02315.47
5.5.50.0060.01815.39
5.5.40.0050.02415.60
5.5.30.0030.02115.66
5.5.20.0070.02515.43
5.5.10.0050.02215.60
5.5.00.0050.02215.40
5.4.450.0070.03315.27
5.4.440.0040.04315.26
5.4.430.0080.03915.18
5.4.420.0110.03515.33
5.4.410.0070.03915.04
5.4.400.0090.03515.04
5.4.390.0070.03715.05
5.4.380.0000.02715.05
5.4.370.0070.02614.95
5.4.360.0000.02814.94
5.4.350.0050.04314.88
5.4.340.0080.03915.06
5.4.330.0000.01110.85
5.4.320.0050.04314.79
5.4.310.0070.04015.01
5.4.300.0080.04015.08
5.4.290.0050.02515.00
5.4.280.0020.03914.93
5.4.270.0050.03914.78
5.4.260.0030.04614.82
5.4.250.0050.02515.03
5.4.240.0080.01714.84
5.4.230.0070.02214.96
5.4.220.0060.02114.89
5.4.210.0060.02214.91
5.4.200.0060.02114.86
5.4.190.0040.02314.93
5.4.180.0040.02014.93
5.4.170.0020.02414.92
5.4.160.0070.02014.96
5.4.150.0100.01314.78
5.4.140.0070.01713.70
5.4.130.0060.01513.57
5.4.120.0020.02513.73
5.4.110.0030.02013.65
5.4.100.0070.02013.74
5.4.90.0100.01113.81
5.4.80.0030.02113.72
5.4.70.0080.01713.59
5.4.60.0040.01613.60
5.4.50.0030.02213.59
5.4.40.0020.02213.73
5.4.30.0070.01713.71
5.4.20.0030.01813.69
5.4.10.0060.01613.78
5.4.00.0140.01013.33
5.3.290.0130.03312.74
5.3.280.0010.02112.64
5.3.270.0110.01512.68
5.3.260.0030.02312.62
5.3.250.0030.02312.66
5.3.240.0000.02112.64
5.3.230.0050.02212.68
5.3.220.0070.02212.69
5.3.210.0050.01912.68
5.3.200.0000.02212.67
5.3.190.0060.01712.66
5.3.180.0090.01512.61
5.3.170.0040.02012.61
5.3.160.0070.02212.62
5.3.150.0050.02112.68
5.3.140.0030.02012.62
5.3.130.0010.02112.64
5.3.120.0000.03312.57
5.3.110.0030.02012.65
5.3.100.0050.02012.34
5.3.90.0050.02612.37
5.3.80.0040.01712.43
5.3.70.0050.01812.30
5.3.60.0030.01812.40
5.3.50.0070.01412.33
5.3.40.0020.02412.33
5.3.30.0060.02112.25
5.3.20.0030.01612.20
5.3.10.0000.02512.19
5.3.00.0050.01412.20
5.2.170.0020.01611.35
5.2.160.0010.01511.35
5.2.150.0050.01511.35
5.2.140.0030.01511.35
5.2.130.0020.02011.35
5.2.120.0020.01711.35
5.2.110.0040.01311.35
5.2.100.0000.01711.35
5.2.90.0030.01711.35
5.2.80.0030.01711.35
5.2.70.0050.01811.35
5.2.60.0070.01811.35
5.2.50.0030.01611.35
5.2.40.0000.01811.35
5.2.30.0040.01611.35
5.2.20.0050.01811.35
5.2.10.0030.01111.35
5.2.00.0070.01011.35
5.1.60.0050.01211.35
5.1.50.0030.01111.35
5.1.40.0020.01511.35
5.1.30.0020.01911.35
5.1.20.0030.02711.35
5.1.10.0050.02611.35
5.1.00.0090.02511.35
5.0.50.0040.02511.35
5.0.40.0050.01811.35
5.0.30.0030.03111.35
5.0.20.0020.01511.35
5.0.10.0020.02111.35
5.0.00.0030.01511.35
4.4.90.0000.01211.35
4.4.80.0030.00711.35
4.4.70.0000.01311.35
4.4.60.0000.00811.35
4.4.50.0000.01011.35
4.4.40.0020.01511.35
4.4.30.0010.01111.35
4.4.20.0040.01011.35
4.4.10.0080.01311.35
4.4.00.0050.01011.35
4.3.110.0020.01711.35
4.3.100.0000.01911.35
4.3.90.0050.00711.35
4.3.80.0020.02411.35
4.3.70.0020.01711.35
4.3.60.0000.01511.35
4.3.50.0020.02011.35
4.3.40.0030.01511.35
4.3.30.0030.01811.35
4.3.20.0030.01711.35
4.3.10.0000.01811.35
4.3.00.0020.01711.35

preferences:
34.84 ms | 400 KiB | 5 Q