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); $newString = $newString . "-" . $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.0180.00016.38
8.3.50.0100.00618.06
8.3.40.0110.00718.70
8.3.30.0110.00418.73
8.3.20.0040.00420.34
8.3.10.0070.00723.61
8.3.00.0100.00323.36
8.2.180.0100.00718.29
8.2.170.0110.00422.96
8.2.160.0070.01020.36
8.2.150.0050.00324.18
8.2.140.0070.01024.66
8.2.130.0030.00621.03
8.2.120.0050.00326.35
8.2.110.0060.00321.18
8.2.100.0110.00017.91
8.2.90.0000.00819.17
8.2.80.0040.00417.97
8.2.70.0040.00717.63
8.2.60.0050.00318.04
8.2.50.0040.00418.07
8.2.40.0030.00622.27
8.2.30.0040.00420.66
8.2.20.0040.00417.83
8.2.10.0070.00018.15
8.2.00.0030.00518.02
8.1.280.0100.00725.92
8.1.270.0100.00720.32
8.1.260.0060.00328.09
8.1.250.0140.00728.09
8.1.240.0070.00321.38
8.1.230.0090.00317.42
8.1.220.0040.00417.78
8.1.210.0040.00418.77
8.1.200.0000.00917.23
8.1.190.0060.00317.23
8.1.180.0040.00418.10
8.1.170.0030.00618.51
8.1.160.0000.00720.68
8.1.150.0000.01018.83
8.1.140.0000.00819.59
8.1.130.0050.00217.66
8.1.120.0040.00417.52
8.1.110.0040.00417.37
8.1.100.0050.00217.36
8.1.90.0030.00517.50
8.1.80.0050.00517.54
8.1.70.0000.00717.34
8.1.60.0040.00417.52
8.1.50.0080.00017.58
8.1.40.0080.00017.51
8.1.30.0030.00617.66
8.1.20.0040.00417.51
8.1.10.0000.00817.48
8.1.00.0090.00017.48
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0000.00718.52
8.0.270.0030.00317.20
8.0.260.0070.00017.19
8.0.250.0000.00617.07
8.0.240.0000.00717.04
8.0.230.0040.00416.92
8.0.220.0030.00617.00
8.0.210.0050.00217.02
8.0.200.0030.00316.95
8.0.190.0050.00317.00
8.0.180.0040.00416.97
8.0.170.0040.00417.05
8.0.160.0000.00716.99
8.0.150.0040.00416.89
8.0.140.0000.00716.97
8.0.130.0050.00513.41
8.0.120.0080.00316.96
8.0.110.0000.00716.95
8.0.100.0040.00416.97
8.0.90.0000.00816.80
8.0.80.0090.00617.01
8.0.70.0000.00817.00
8.0.60.0040.00417.03
8.0.50.0000.00716.87
8.0.30.0140.00817.10
8.0.20.0080.01017.40
8.0.10.0000.00817.00
8.0.00.0120.01016.75
7.4.330.0060.00016.79
7.4.320.0040.00416.58
7.4.300.0000.00616.63
7.4.290.0070.00016.67
7.4.280.0030.00516.57
7.4.270.0030.00316.43
7.4.260.0040.00416.66
7.4.250.0000.00816.44
7.4.240.0030.00316.58
7.4.230.0030.00316.54
7.4.220.0100.01016.62
7.4.210.0120.00816.43
7.4.200.0050.00316.57
7.4.160.0060.00916.43
7.4.150.0160.00317.40
7.4.140.0070.01417.86
7.4.130.0050.01216.62
7.4.120.0080.00816.51
7.4.110.0100.00716.30
7.4.100.0150.00616.51
7.4.90.0110.00716.65
7.4.80.0160.00619.39
7.4.70.0060.00916.52
7.4.60.0060.01216.56
7.4.50.0020.00916.29
7.4.40.0120.00916.53
7.4.30.0080.00816.62
7.4.10.0040.01415.13
7.4.00.0090.00714.99
7.3.330.0000.00613.32
7.3.320.0020.00213.25
7.3.310.0040.00416.43
7.3.300.0000.00716.47
7.3.290.0060.01216.42
7.3.280.0120.00716.40
7.3.270.0090.00917.40
7.3.260.0100.00716.67
7.3.250.0120.00716.48
7.3.240.0050.01416.37
7.3.230.0070.01016.54
7.3.210.0110.00716.49
7.3.200.0050.01116.32
7.3.190.0120.00416.61
7.3.180.0110.00516.47
7.3.170.0000.01616.38
7.3.160.0080.00816.50
7.3.130.0060.01214.83
7.3.120.0100.01014.93
7.3.110.0030.00914.77
7.3.100.0100.00614.88
7.3.90.0040.01114.99
7.3.80.0100.00314.91
7.3.70.0090.00914.64
7.3.60.0090.00914.55
7.3.50.0000.00914.97
7.3.40.0070.01014.81
7.3.30.0070.00714.62
7.3.20.0000.00816.78
7.3.10.0030.00916.54
7.3.00.0020.00816.64
7.2.330.0100.00716.71
7.2.320.0130.01016.48
7.2.310.0100.00716.86
7.2.300.0080.00816.68
7.2.290.0090.01216.61
7.2.260.0070.01315.29
7.2.250.0070.01015.02
7.2.240.0060.00914.82
7.2.230.0070.01115.10
7.2.220.0070.00715.01
7.2.210.0040.01115.05
7.2.200.0060.00915.09
7.2.190.0100.00714.96
7.2.180.0040.01214.96
7.2.170.0030.01315.18
7.2.160.0150.00015.04
7.2.150.0110.00017.03
7.2.140.0030.01217.06
7.2.130.0050.00916.85
7.2.120.0080.00616.98
7.2.110.0070.00516.89
7.2.100.0050.00816.76
7.2.90.0080.00516.92
7.2.80.0060.00816.88
7.2.70.0030.00716.87
7.2.60.0060.00716.94
7.2.50.0050.00816.97
7.2.40.0030.01117.01
7.2.30.0050.01016.84
7.2.20.0080.00417.05
7.2.10.0050.00816.94
7.2.00.0070.00617.75
7.1.330.0060.00915.91
7.1.320.0030.00815.57
7.1.310.0000.01115.96
7.1.300.0000.01215.74
7.1.290.0100.00715.78
7.1.280.0100.00315.79
7.1.270.0030.01315.75
7.1.260.0030.01015.86
7.1.250.0040.00815.80
7.1.240.0050.00515.71
7.1.230.0050.00515.92
7.1.220.0010.01215.95
7.1.210.0070.00915.83
7.1.200.0090.00515.70
7.1.190.0040.00615.83
7.1.180.0030.01015.77
7.1.170.0080.00315.89
7.1.160.0030.01315.95
7.1.150.0040.01015.65
7.1.140.0070.00515.68
7.1.130.0030.00815.90
7.1.120.0050.00915.90
7.1.110.0030.00715.78
7.1.100.0040.00616.52
7.1.90.0040.00915.96
7.1.80.0090.00215.71
7.1.70.0070.00616.24
7.1.60.0070.01017.03
7.1.50.0030.00916.27
7.1.40.0070.00815.74
7.1.30.0030.00715.56
7.1.20.0040.00915.80
7.1.10.0030.00915.51
7.1.00.0020.03417.82
7.0.330.0080.00515.47
7.0.320.0040.00915.30
7.0.310.0030.00915.45
7.0.300.0050.00915.49
7.0.290.0050.00815.29
7.0.280.0040.00915.30
7.0.270.0100.00315.35
7.0.260.0050.00815.17
7.0.250.0050.00715.50
7.0.240.0030.00615.19
7.0.230.0060.00515.34
7.0.220.0030.01015.54
7.0.210.0050.00415.59
7.0.200.0050.00315.81
7.0.190.0070.00815.54
7.0.180.0060.00415.43
7.0.170.0070.00715.47
7.0.160.0050.00715.48
7.0.150.0040.00715.43
7.0.140.0050.00515.49
7.0.130.0080.00715.31
7.0.120.0050.00815.54
7.0.110.0040.00915.42
7.0.100.0100.00315.46
7.0.90.0100.00315.28
7.0.80.0050.00915.35
7.0.70.0090.00515.51
7.0.60.0080.02917.06
7.0.50.0040.01916.29
7.0.40.0060.01815.54
7.0.30.0120.02815.78
7.0.20.0070.02715.76
7.0.10.0090.03115.67
7.0.00.0070.01915.66
5.6.400.0030.00914.08
5.6.390.0080.00514.68
5.6.380.0030.00814.22
5.6.370.0070.00714.38
5.6.360.0040.00614.44
5.6.350.0080.00714.41
5.6.340.0030.00914.44
5.6.330.0080.00514.28
5.6.320.0010.01214.51
5.6.310.0050.00814.39
5.6.300.0060.00614.47
5.6.290.0050.00914.18
5.6.280.0050.02716.57
5.6.270.0010.01114.23
5.6.260.0050.00914.25
5.6.250.0030.00714.31
5.6.240.0030.00814.51
5.6.230.0060.00614.23
5.6.220.0020.01114.40
5.6.210.0040.02516.33
5.6.200.0070.03115.72
5.6.190.0070.01916.37
5.6.180.0120.01716.17
5.6.170.0160.02816.33
5.6.160.0050.02816.39
5.6.150.0030.01815.60
5.6.140.0040.02215.66
5.6.130.0040.02715.66
5.6.120.0050.03316.60
5.6.110.0070.01616.60
5.6.100.0070.02516.64
5.6.90.0050.03116.53
5.6.80.0120.02816.48
5.6.70.0040.00414.20
5.6.60.0060.00614.38
5.6.50.0080.00614.32
5.6.40.0000.01014.26
5.6.30.0050.00814.24
5.6.20.0090.00614.33
5.6.10.0070.00514.36
5.6.00.0080.00514.19
5.5.380.0020.01212.61
5.5.370.0040.00312.63
5.5.360.0040.01012.58
5.5.350.0120.02215.18
5.5.340.0050.03214.38
5.5.330.0070.03615.31
5.5.320.0140.01515.28
5.5.310.0110.01715.21
5.5.300.0010.02014.36
5.5.290.0080.01914.55
5.5.280.0060.02515.48
5.5.270.0080.01515.34
5.5.260.0070.02215.34
5.5.250.0040.01815.27
5.5.240.0030.03115.24
5.5.230.0060.00512.62
5.5.220.0080.00212.72
5.5.210.0020.01112.70
5.5.200.0070.00512.59
5.5.190.0050.00812.73
5.5.180.0090.00112.61
5.5.170.0030.00912.66
5.5.160.0050.00712.63
5.5.150.0030.01012.61
5.5.140.0080.00312.82
5.5.130.0020.00912.63
5.5.120.0100.00512.69
5.5.110.0080.00612.64
5.5.100.0060.00512.79
5.5.90.0090.00512.77
5.5.80.0000.01112.76
5.5.70.0070.00312.78
5.5.60.0010.01312.76
5.5.50.0030.00812.59
5.5.40.0070.00512.75
5.5.30.0050.00712.70
5.5.20.0020.00812.61
5.5.10.0020.01212.59
5.5.00.0040.00412.57

preferences:
46.29 ms | 400 KiB | 5 Q