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)) . " - " . (int)$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.60.0040.01118.43
8.3.50.0110.00521.22
8.3.40.0100.01018.78
8.3.30.0150.00618.67
8.3.20.0090.00020.39
8.3.10.0080.00023.51
8.3.00.0040.00423.65
8.2.180.0180.00718.04
8.2.170.0040.01118.79
8.2.160.0100.00322.96
8.2.150.0080.00024.18
8.2.140.0110.00424.66
8.2.130.0080.00019.30
8.2.120.0030.00526.35
8.2.110.0060.00322.11
8.2.100.0040.00818.05
8.2.90.0020.00519.21
8.2.80.0050.00318.03
8.2.70.0030.00617.63
8.2.60.0040.00817.79
8.2.50.0050.00318.07
8.2.40.0080.00022.23
8.2.30.0070.00320.55
8.2.20.0000.00717.68
8.2.10.0070.00018.04
8.2.00.0000.00718.23
8.1.280.0090.00625.92
8.1.270.0060.00320.24
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0040.00423.92
8.1.230.0040.00719.11
8.1.220.0060.00317.74
8.1.210.0000.00918.77
8.1.200.0030.00617.23
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0000.00818.54
8.1.160.0040.00420.76
8.1.150.0040.00718.90
8.1.140.0050.00319.58
8.1.130.0040.00417.69
8.1.120.0070.00017.44
8.1.110.0040.00417.48
8.1.100.0000.00717.44
8.1.90.0000.00717.36
8.1.80.0000.00917.48
8.1.70.0000.00717.31
8.1.60.0040.00417.59
8.1.50.0030.00517.57
8.1.40.0040.00417.54
8.1.30.0000.00817.49
8.1.20.0000.00717.71
8.1.10.0040.00417.44
8.1.00.0040.00417.36
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0030.00318.41
8.0.270.0000.00817.23
8.0.260.0070.00017.27
8.0.250.0030.00316.96
8.0.240.0040.00416.86
8.0.230.0030.00316.95
8.0.220.0000.00816.91
8.0.210.0030.00316.79
8.0.200.0000.00616.93
8.0.190.0000.00816.85
8.0.180.0000.00816.83
8.0.170.0040.00416.86
8.0.160.0000.00716.87
8.0.150.0000.00816.73
8.0.140.0030.00616.76
8.0.130.0060.00013.36
8.0.120.0030.00516.88
8.0.110.0000.00716.79
8.0.100.0000.00716.85
8.0.90.0040.00416.75
8.0.80.0110.01116.93
8.0.70.0040.00416.70
8.0.60.0000.00716.75
8.0.50.0000.00716.78
8.0.30.0110.01017.01
8.0.20.0130.00517.40
8.0.10.0060.00316.80
8.0.00.0100.01316.80
7.4.330.0000.00516.68
7.4.320.0030.00316.52
7.4.300.0060.00016.41
7.4.290.0030.00316.50
7.4.280.0040.00416.50
7.4.270.0030.00316.61
7.4.260.0060.00316.50
7.4.250.0070.00016.47
7.4.240.0040.00416.51
7.4.230.0030.00316.31
7.4.220.0190.00716.72
7.4.210.0060.00916.71
7.4.200.0070.00016.68
7.4.160.0000.01616.30
7.4.150.0060.01217.40
7.4.140.0090.01117.86
7.4.130.0100.00716.56
7.4.120.0060.01016.49
7.4.110.0080.00816.56
7.4.100.0130.00316.50
7.4.90.0160.00316.51
7.4.80.0130.00919.39
7.4.70.0100.00616.59
7.4.60.0060.01016.64
7.4.50.0030.01216.41
7.4.40.0080.01116.41
7.4.30.0090.01316.50
7.4.00.0030.01314.87
7.3.330.0020.00213.27
7.3.320.0020.00313.28
7.3.310.0030.00316.43
7.3.300.0030.00316.41
7.3.290.0090.00816.36
7.3.280.0100.00816.36
7.3.270.0110.00717.40
7.3.260.0100.00716.25
7.3.250.0120.00516.36
7.3.240.0070.01316.55
7.3.230.0130.00316.48
7.3.210.0080.00816.38
7.3.200.0090.00816.65
7.3.190.0110.00616.39
7.3.180.0120.00316.65
7.3.170.0100.00616.54
7.3.160.0060.00916.45
7.2.330.0090.00916.76
7.2.320.0030.01216.35
7.2.310.0150.00816.78
7.2.300.0090.00816.41
7.2.290.0080.00816.77
7.2.80.0060.00616.59
7.2.60.0090.00616.92
7.2.00.0030.00719.45
7.1.200.0040.00815.79
7.1.100.0070.01018.27
7.1.70.0040.00417.22
7.1.60.0030.02219.52
7.1.50.0130.00316.86
7.1.00.0070.07722.37
7.0.200.0030.00316.82
7.0.60.0000.08719.89
7.0.50.0030.04017.82
7.0.40.0070.07320.21
7.0.30.0430.06320.33
7.0.20.0300.06720.01
7.0.10.0100.08320.00
7.0.00.0070.04320.16
5.6.280.0030.03721.04
5.6.210.0100.07720.73
5.6.200.0030.08318.11
5.6.190.0070.04020.41
5.6.180.0300.06020.68
5.6.170.0200.08020.50
5.6.160.0070.08320.54
5.6.150.0100.03718.18
5.6.140.0030.05718.18
5.6.130.0000.05018.16
5.6.120.0030.08321.11
5.6.110.0030.04321.04
5.6.100.0070.07720.98
5.6.90.0070.08721.11
5.6.80.0030.06720.39
5.5.350.0230.03020.43
5.5.340.0100.07017.92
5.5.330.0130.03720.25
5.5.320.0370.06320.18
5.5.310.0270.08020.21
5.5.300.0100.08318.00
5.5.290.0030.07017.91
5.5.280.0030.08720.98
5.5.270.0130.07320.88
5.5.260.0100.04320.76
5.5.250.0130.03020.61
5.5.240.0130.03320.36

preferences:
52.8 ms | 401 KiB | 5 Q