3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Fasd-2"; $sub=substr($string, strrpos($string, "-")+1, strlen($string) - strrpos($string, "-")); if (is_numeric($sub)) { $newString = substr($string, 0, strlen($string) - strlen($sub) -1) . "-" . $sub+1; } else { $newString = $string . "-1"; } echo $newString;

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.0180.00416.36
8.3.60.0160.00316.50
8.3.50.0110.00721.21
8.3.40.0060.01318.63
8.3.30.0070.00718.90
8.3.20.0000.00720.13
8.3.10.0100.00523.61
8.3.00.0000.00723.46
8.2.190.0140.00718.29
8.2.180.0110.00717.99
8.2.170.0120.00322.96
8.2.160.0100.00720.50
8.2.150.0090.00024.18
8.2.140.0090.00924.66
8.2.130.0030.00621.17
8.2.120.0050.00326.35
8.2.110.0060.00321.93
8.2.100.0080.00517.68
8.2.90.0020.00519.22
8.2.80.0040.00417.97
8.2.70.0070.00317.63
8.2.60.0030.00617.80
8.2.50.0030.00618.07
8.2.40.0040.00422.32
8.2.30.0060.00320.73
8.2.20.0000.00717.68
8.2.10.0040.00418.06
8.2.00.0030.00518.10
8.1.280.0070.00725.92
8.1.270.0080.00020.33
8.1.260.0090.00928.09
8.1.250.0060.00328.09
8.1.240.0030.00623.96
8.1.230.0110.00019.09
8.1.220.0030.00617.74
8.1.210.0000.00918.77
8.1.200.0040.00417.22
8.1.190.0050.00317.23
8.1.180.0050.00318.10
8.1.170.0080.00018.65
8.1.160.0040.00420.87
8.1.150.0050.00518.80
8.1.140.0000.00819.57
8.1.130.0030.00617.80
8.1.120.0030.00417.36
8.1.110.0070.00017.47
8.1.100.0000.00717.48
8.1.90.0020.00517.39
8.1.80.0070.00317.36
8.1.70.0070.00017.30
8.1.60.0080.00017.61
8.1.50.0040.00417.56
8.1.40.0000.00817.58
8.1.30.0030.00617.66
8.1.20.0080.00017.55
8.1.10.0000.00817.55
8.1.00.0040.00417.33
8.0.300.0000.00718.77
8.0.290.0000.00716.63
8.0.280.0000.00718.45
8.0.270.0070.00017.25
8.0.260.0000.00817.30
8.0.250.0040.00417.04
8.0.240.0000.00716.91
8.0.230.0040.00416.99
8.0.220.0080.00016.99
8.0.210.0040.00416.97
8.0.200.0060.00016.90
8.0.190.0040.00416.90
8.0.180.0090.00016.95
8.0.170.0040.00416.95
8.0.160.0040.00416.96
8.0.150.0070.00016.82
8.0.140.0000.00716.79
8.0.130.0030.00313.36
8.0.120.0030.00716.80
8.0.110.0000.00816.84
8.0.100.0060.00316.90
8.0.90.0040.00416.90
8.0.80.0110.00416.88
8.0.70.0070.00016.91
8.0.60.0000.00716.90
8.0.50.0070.00017.00
8.0.30.0110.00717.02
8.0.20.0120.00717.40
8.0.10.0000.00716.97
8.0.00.0120.01016.72
7.4.330.0050.00016.81
7.4.320.0030.00316.41
7.4.300.0030.00316.48
7.4.290.0070.00016.53
7.4.280.0080.00016.60
7.4.270.0040.00416.51
7.4.260.0000.00716.38
7.4.250.0070.00016.61
7.4.240.0020.00516.56
7.4.230.0030.00316.45
7.4.220.0070.01116.48
7.4.210.0070.00716.48
7.4.200.0030.00316.39
7.4.160.0030.02016.62
7.4.150.0100.00717.40
7.4.140.0150.00817.86
7.4.130.0040.01416.49
7.4.120.0110.00816.37
7.4.110.0130.00616.55
7.4.100.0140.00616.47
7.4.90.0100.00716.43
7.4.80.0030.01319.39
7.4.70.0060.00916.64
7.4.60.0130.00316.37
7.4.50.0040.01216.62
7.4.40.0060.01216.41
7.4.30.0110.00716.61
7.4.00.0070.00714.98
7.3.330.0000.00513.23
7.3.320.0030.00313.15
7.3.310.0000.00716.32
7.3.300.0000.00716.23
7.3.290.0120.00416.39
7.3.280.0100.00916.42
7.3.270.0120.00617.40
7.3.260.0130.00316.38
7.3.250.0100.00916.51
7.3.240.0090.00716.55
7.3.230.0100.00716.55
7.3.210.0090.00616.36
7.3.200.0100.00716.34
7.3.190.0060.00916.31
7.3.180.0140.00316.59
7.3.170.0150.00416.33
7.3.160.0060.00916.24
7.2.330.0140.00416.44
7.2.320.0150.00616.64
7.2.310.0090.00916.71
7.2.300.0090.00916.70
7.2.290.0070.01416.63
7.2.80.0070.00716.54
7.2.60.0030.00716.89
7.2.00.0040.00819.50
7.1.200.0000.01015.63
7.1.100.0030.00617.93
7.1.70.0060.00617.29
7.1.60.0090.01619.52
7.1.50.0150.00716.86
7.1.00.0000.08022.35
7.0.200.0000.00716.78
7.0.60.0070.04720.02
7.0.50.0000.04317.88
7.0.40.0130.08020.23
7.0.30.0200.04720.24
7.0.20.0230.05020.00
7.0.10.0130.08020.32
7.0.00.0170.04020.16
5.6.280.0000.03721.04
5.6.210.0130.06320.47
5.6.200.0030.08318.26
5.6.190.0030.05020.35
5.6.180.0270.06320.35
5.6.170.0270.07320.41
5.6.160.0170.07720.49
5.6.150.0100.04318.21
5.6.140.0000.05018.09
5.6.130.0200.04718.07
5.6.120.0130.06721.01
5.6.110.0030.04321.02
5.6.100.0170.08021.08
5.6.90.0030.08021.02
5.6.80.0100.08020.41
5.5.350.0170.03720.40
5.5.340.0030.08718.01
5.5.330.0170.05020.46
5.5.320.0270.04320.31
5.5.310.0200.05320.21
5.5.300.0030.04017.95
5.5.290.0100.08018.01
5.5.280.0100.05320.79
5.5.270.0100.04320.96
5.5.260.0100.07020.75
5.5.250.0030.04020.75
5.5.240.0200.03020.36

preferences:
35.24 ms | 401 KiB | 5 Q