3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "this is a Test String to get the last index of word with an uppercase letter in PHP"; $pattern = "/.*\s([A-Z])(\w+)/"; $pattern = "/.*\s([A-Z])([A-Z]+)/"; preg_match($pattern, $str, $match); $letter = $match[1]; $word = $match[1] . $match[2]; $position = strrpos($str, $match[1].$match[2]); echo "Letter to find: " . $letter . "\nWord to find: " . $word . "\nPosition of letter: " . $position;

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.0090.01218.68
8.3.50.0070.00716.41
8.3.40.0030.01218.92
8.3.30.0140.00018.97
8.3.20.0080.00320.22
8.3.10.0040.00423.53
8.3.00.0080.00019.68
8.2.180.0090.00918.43
8.2.170.0040.01122.96
8.2.160.0060.00919.21
8.2.150.0070.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00419.14
8.2.120.0040.00426.35
8.2.110.0100.00022.39
8.2.100.0050.00518.22
8.2.90.0030.00517.97
8.2.80.0000.00818.03
8.2.70.0030.00518.04
8.2.60.0030.00618.09
8.2.50.0080.00018.10
8.2.40.0000.00720.59
8.2.30.0040.00419.34
8.2.20.0040.00418.07
8.2.10.0040.00418.14
8.2.00.0040.00418.02
8.1.280.0110.00725.92
8.1.270.0090.00620.73
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00320.99
8.1.230.0070.00320.88
8.1.220.0020.00520.93
8.1.210.0040.00418.80
8.1.200.0080.00017.47
8.1.190.0030.00517.35
8.1.180.0000.00818.10
8.1.170.0000.00918.95
8.1.160.0040.00419.09
8.1.150.0030.00518.82
8.1.140.0030.00819.53
8.1.130.0030.00518.91
8.1.120.0000.00717.65
8.1.110.0000.00817.55
8.1.100.0050.00317.46
8.1.90.0020.00517.49
8.1.80.0000.00817.58
8.1.70.0000.00717.61
8.1.60.0040.00417.74
8.1.50.0060.00317.68
8.1.40.0080.00017.52
8.1.30.0060.00317.72
8.1.20.0000.00717.79
8.1.10.0000.00817.66
8.1.00.0080.00017.51
8.0.300.0000.00719.80
8.0.290.0050.00216.88
8.0.280.0000.00718.51
8.0.270.0000.00717.27
8.0.260.0030.00317.00
8.0.250.0000.00817.01
8.0.240.0000.00717.09
8.0.230.0030.00317.00
8.0.220.0050.00217.04
8.0.210.0000.00717.10
8.0.200.0070.00017.13
8.0.190.0030.00617.01
8.0.180.0000.00717.06
8.0.170.0030.00317.05
8.0.160.0000.00817.11
8.0.150.0000.00816.87
8.0.140.0030.00316.89
8.0.130.0000.00613.45
8.0.120.0040.00416.98
8.0.110.0000.00716.84
8.0.100.0040.00417.09
8.0.90.0040.00417.06
8.0.80.0130.01017.00
8.0.70.0040.00416.83
8.0.60.0050.00316.98
8.0.50.0040.00417.07
8.0.30.0120.00617.09
8.0.20.0120.01017.42
8.0.10.0040.00416.91
8.0.00.0070.01716.87
7.4.330.0030.00315.55
7.4.320.0000.00616.72
7.4.300.0070.00016.77
7.4.290.0050.00616.71
7.4.280.0050.00216.84
7.4.270.0030.00316.81
7.4.260.0080.00016.59
7.4.250.0000.00816.59
7.4.240.0030.00316.71
7.4.230.0000.00716.50
7.4.220.0060.01316.82
7.4.210.0000.01516.59
7.4.200.0040.00416.86
7.4.160.0070.01016.64
7.4.150.0110.00717.40
7.4.140.0120.00617.86
7.4.130.0140.00416.69
7.4.120.0160.00316.78
7.4.110.0080.01216.68
7.4.100.0130.00616.72
7.4.90.0100.00716.61
7.4.80.0100.01019.39
7.4.70.0090.00916.59
7.4.60.0060.00916.58
7.4.50.0040.00816.80
7.4.40.0140.00416.75
7.4.30.0070.01016.74
7.4.00.0060.00915.28
7.3.330.0050.00013.38
7.3.320.0000.00513.22
7.3.310.0070.00016.32
7.3.300.0000.00716.46
7.3.290.0100.00416.43
7.3.280.0100.00916.42
7.3.270.0030.01617.40
7.3.260.0050.01316.59
7.3.250.0070.01216.75
7.3.240.0070.01416.63
7.3.230.0100.01116.46
7.3.210.0120.00316.66
7.3.200.0130.00316.33
7.3.190.0110.00616.79
7.3.180.0000.01716.48
7.3.170.0060.01016.48
7.3.160.0060.00916.50
7.3.10.0030.00516.39
7.3.00.0000.01316.59
7.2.330.0100.00716.56
7.2.320.0060.01116.97
7.2.310.0040.01616.97
7.2.300.0140.00316.61
7.2.290.0060.00916.82
7.2.130.0180.00017.04
7.2.120.0070.01016.75
7.2.110.0030.00617.07
7.2.100.0070.00716.98
7.2.90.0130.00716.84
7.2.80.0180.00316.97
7.2.70.0110.00716.97
7.2.60.0450.00916.13
7.2.50.0040.00417.19
7.2.40.0100.00317.01
7.2.30.0030.00717.34
7.2.20.0210.00717.20
7.2.10.0120.01216.91
7.2.00.0110.00518.37
7.1.250.0000.01315.66
7.1.200.0070.00416.20
7.1.100.0000.01118.25
7.1.70.0260.00915.47
7.1.60.0390.02133.51
7.1.50.0480.00932.95
7.1.40.0340.01132.98
7.1.30.0280.02332.81
7.1.20.0470.01332.98
7.1.10.0180.02014.70
7.1.00.0310.01214.86
7.0.200.0220.01215.00
7.0.190.0220.01315.00
7.0.180.0180.00914.62
7.0.170.0200.01714.63
7.0.160.0460.01414.74
7.0.150.0270.01214.51
7.0.140.0380.00614.61
7.0.130.0320.01114.98
7.0.120.0200.01714.89
7.0.110.0250.01314.51
7.0.100.0180.02214.62
7.0.90.0320.00614.69
7.0.80.0340.01414.80
7.0.70.0280.01014.56
7.0.60.0310.00814.57
7.0.50.0280.01414.60
7.0.40.0290.00915.05
7.0.30.0200.01014.95
7.0.20.0180.00914.83
7.0.10.0170.00914.88
7.0.00.0160.01114.70

preferences:
41.83 ms | 401 KiB | 5 Q