3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'thing_1'; $pieces = explode('_', $str); $suffix = array_pop($pieces); if ($str == $suffix) { $pieces[] = 1; } else { (int) $suffix; $pieces[count($pieces - 1)] = $suffix + 1; } $new_str = implode('_', $pieces);

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.0150.00418.42
8.3.60.0100.01018.30
8.3.50.0110.00821.20
8.3.40.0100.01018.70
8.3.30.0040.01118.68
8.3.20.0050.00320.16
8.3.10.0080.00023.66
8.3.00.0040.00421.01
8.2.190.0070.00716.75
8.2.180.0120.00918.54
8.2.170.0090.00622.96
8.2.160.0070.00720.52
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00019.22
8.2.120.0040.00426.35
8.2.110.0090.00021.00
8.2.100.0060.00617.78
8.2.90.0030.00517.78
8.2.80.0040.00418.03
8.2.70.0040.00417.63
8.2.60.0030.00617.63
8.2.50.0000.00717.63
8.2.40.0000.00717.75
8.2.30.0000.00720.68
8.2.20.0000.00717.60
8.2.10.0040.00418.05
8.2.00.0000.00717.93
8.1.280.0040.01125.92
8.1.270.0050.00320.42
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0000.01023.82
8.1.230.0030.00822.74
8.1.220.0060.00317.76
8.1.210.0040.00418.77
8.1.200.0080.00017.36
8.1.190.0090.00016.98
8.1.180.0040.00418.10
8.1.170.0090.00018.55
8.1.160.0000.00720.80
8.1.150.0000.00718.81
8.1.140.0060.00319.56
8.1.130.0040.00417.70
8.1.120.0030.00317.37
8.1.110.0030.00517.41
8.1.100.0040.00417.47
8.1.90.0040.00417.44
8.1.80.0050.00317.36
8.1.70.0080.00017.45
8.1.60.0000.00717.59
8.1.50.0000.00817.48
8.1.40.0030.00517.40
8.1.30.0040.00417.61
8.1.20.0040.00417.63
8.1.10.0100.00017.63
8.1.00.0040.00417.56
8.0.300.0080.00019.98
8.0.290.0040.00416.61
8.0.280.0000.00718.37
8.0.270.0000.00717.19
8.0.260.0030.00317.14
8.0.250.0070.00016.95
8.0.240.0040.00416.95
8.0.230.0000.00816.97
8.0.220.0070.00016.87
8.0.210.0000.00716.89
8.0.200.0050.00316.91
8.0.190.0050.00216.92
8.0.180.0000.00716.91
8.0.170.0040.00416.94
8.0.160.0000.00716.87
8.0.150.0040.00416.88
8.0.140.0030.00316.82
8.0.130.0050.00013.30
8.0.120.0050.00316.85
8.0.110.0050.00316.72
8.0.100.0040.00416.92
8.0.90.0000.00716.71
8.0.80.0120.00316.88
8.0.70.0050.00316.86
8.0.60.0060.00316.77
8.0.50.0030.00516.94
8.0.30.0090.00917.01
8.0.20.0060.01317.40
8.0.10.0000.00816.98
8.0.00.0100.01116.64
7.4.330.0000.00616.77
7.4.320.0000.00616.51
7.4.300.0030.00316.44
7.4.290.0070.00416.59
7.4.280.0000.00816.49
7.4.270.0000.00716.59
7.4.260.0080.00016.57
7.4.250.0040.00416.61
7.4.240.0030.00316.50
7.4.230.0030.00316.57
7.4.220.0040.01516.53
7.4.210.0080.00816.66
7.4.200.0050.00216.49
7.4.160.0110.00516.37
7.4.150.0180.00017.40
7.4.140.0140.00817.86
7.4.130.0110.00516.52
7.4.120.0120.00516.53
7.4.110.0140.00416.29
7.4.100.0110.00716.57
7.4.90.0090.00616.42
7.4.80.0030.01319.39
7.4.70.0070.01016.55
7.4.60.0120.00616.48
7.4.50.0070.01016.43
7.4.40.0100.00616.43
7.4.30.0070.01016.67
7.4.00.0030.01214.95
7.3.330.0020.00213.17
7.3.320.0050.00013.16
7.3.310.0040.00416.34
7.3.300.0030.00316.10
7.3.290.0060.00816.27
7.3.280.0090.01016.31
7.3.270.0140.00317.40
7.3.260.0090.01216.40
7.3.250.0100.00816.46
7.3.240.0040.01416.41
7.3.230.0100.00716.39
7.3.210.0050.01016.23
7.3.200.0110.01116.30
7.3.190.0080.00816.46
7.3.180.0120.00916.32
7.3.170.0030.01316.28
7.3.160.0070.01016.50
7.2.330.0130.01316.71
7.2.320.0090.01416.32
7.2.310.0100.00616.78
7.2.300.0150.00616.76
7.2.290.0090.00816.41
7.2.60.0030.01216.84
7.2.00.0070.00719.57
7.1.200.0040.00415.83
7.1.100.0000.01117.91
7.1.70.0000.01317.16
7.1.60.0060.01919.52
7.1.50.0090.01216.64
7.1.00.0030.07722.42
7.0.200.0060.00316.89
7.0.60.0000.04719.91
7.0.50.0030.04317.66
7.0.40.0100.08720.06
7.0.30.0300.04320.00
7.0.20.0430.04720.01
7.0.10.0000.07720.12
7.0.00.0030.04320.10
5.6.280.0000.03321.14
5.6.210.0070.03720.52
5.6.200.0030.04018.18
5.6.190.0070.07320.35
5.6.180.0230.06720.39
5.6.170.0230.03720.49
5.6.160.0100.07720.41
5.6.150.0030.09018.21
5.6.140.0070.08318.07
5.6.130.0130.04318.13
5.6.120.0100.08020.99
5.6.110.0030.09021.13
5.6.100.0100.03720.95
5.6.90.0070.08321.12
5.6.80.0070.08020.39
5.5.350.0100.05020.37
5.5.340.0070.08017.95
5.5.330.0000.07320.23
5.5.320.0600.05320.18
5.5.310.0330.07320.30
5.5.300.0070.03717.97
5.5.290.0130.06717.88
5.5.280.0070.08320.97
5.5.270.0000.09020.75
5.5.260.0070.08020.64
5.5.250.0100.07320.68
5.5.240.3870.03320.27

preferences:
66.82 ms | 401 KiB | 5 Q