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 PHR"; $pattern = "/.*\s([A-Z])(\w+)/"; //$pattern = "/.*\s([A-Z])([A-Z]+)/"; pattern to match only all caps word 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.0120.00918.27
8.3.50.0150.00016.39
8.3.40.0140.00018.68
8.3.30.0140.00018.97
8.3.20.0040.00420.13
8.3.10.0000.00823.59
8.3.00.0050.00319.68
8.2.180.0110.00418.54
8.2.170.0100.00722.96
8.2.160.0140.00019.19
8.2.150.0030.00624.18
8.2.140.0000.00724.66
8.2.130.0000.00819.31
8.2.120.0040.00426.35
8.2.110.0060.00322.19
8.2.100.0030.01017.81
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0040.00817.75
8.2.60.0000.00817.93
8.2.50.0070.00018.10
8.2.40.0000.00820.20
8.2.30.0040.00419.24
8.2.20.0040.00418.01
8.2.10.0080.00018.19
8.2.00.0040.00418.20
8.1.280.0100.00725.92
8.1.270.0040.00422.05
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.84
8.1.230.0080.00322.08
8.1.220.0000.00817.74
8.1.210.0050.00518.77
8.1.200.0030.00617.47
8.1.190.0050.00317.47
8.1.180.0000.00818.10
8.1.170.0030.00618.70
8.1.160.0070.00019.03
8.1.150.0000.00820.76
8.1.140.0090.00019.59
8.1.130.0000.00718.91
8.1.120.0000.00717.60
8.1.110.0040.00417.41
8.1.100.0040.00417.50
8.1.90.0070.00017.61
8.1.80.0040.00417.50
8.1.70.0000.00817.58
8.1.60.0000.00717.78
8.1.50.0040.00417.73
8.1.40.0030.00517.64
8.1.30.0040.00417.84
8.1.20.0030.00517.82
8.1.10.0050.00317.73
8.1.00.0060.00317.62
8.0.300.0080.00018.77
8.0.290.0000.00716.75
8.0.280.0070.00018.47
8.0.270.0000.00817.32
8.0.260.0000.00716.92
8.0.250.0000.00716.96
8.0.240.0030.00317.11
8.0.230.0000.00716.96
8.0.220.0000.00717.01
8.0.210.0030.00317.02
8.0.200.0000.00617.15
8.0.190.0040.00416.99
8.0.180.0000.00717.08
8.0.170.0040.00417.03
8.0.160.0040.00417.04
8.0.150.0000.00816.87
8.0.140.0000.00716.89
8.0.130.0030.00613.45
8.0.120.0060.00316.91
8.0.110.0000.00717.07
8.0.100.0050.00216.87
8.0.90.0040.00417.05
8.0.80.0120.00917.10
8.0.70.0040.00416.88
8.0.60.0050.00316.91
8.0.50.0050.00316.91
8.0.30.0120.00617.12
8.0.20.0070.01417.40
8.0.10.0040.00417.04
8.0.00.0090.00916.74
7.4.330.0050.00015.55
7.4.320.0070.00016.75
7.4.300.0030.00316.81
7.4.290.0030.00716.70
7.4.280.0000.00716.79
7.4.270.0070.00016.80
7.4.260.0070.00016.78
7.4.250.0050.00316.76
7.4.240.0020.00516.80
7.4.230.0030.00316.75
7.4.220.0100.00716.64
7.4.210.0060.01016.79
7.4.200.0030.00316.46
7.4.160.0100.00716.64
7.4.150.0080.01217.40
7.4.140.0110.00617.86
7.4.130.0120.00616.61
7.4.120.0130.00616.56
7.4.110.0090.00916.67
7.4.100.0180.00916.78
7.4.90.0140.00316.58
7.4.80.0060.01519.39
7.4.70.0040.01716.72
7.4.60.0090.00816.65
7.4.50.0030.01216.54
7.4.40.0070.01016.81
7.4.30.0130.00316.61
7.4.00.0040.01114.93
7.3.330.0030.00313.18
7.3.320.0030.00313.26
7.3.310.0040.00416.47
7.3.300.0030.00316.51
7.3.290.0120.00316.43
7.3.280.0090.00816.41
7.3.270.0160.01017.40
7.3.260.0090.00816.54
7.3.250.0080.01216.65
7.3.240.0120.00616.61
7.3.230.0060.01616.79
7.3.210.0070.01116.64
7.3.200.0030.01316.46
7.3.190.0120.00616.69
7.3.180.0080.00816.50
7.3.170.0000.01616.66
7.3.160.0000.01716.71
7.2.330.0100.01016.85
7.2.320.0030.01416.97
7.2.310.0130.00316.60
7.2.300.0030.01316.71
7.2.290.0000.02116.60
7.2.60.0710.00715.29
7.2.00.0070.01119.82
7.1.200.0030.00915.66
7.1.100.0040.01218.48
7.1.70.0240.00315.53
7.1.60.0410.00633.65
7.1.50.0450.01333.19
7.1.40.0350.01832.87
7.1.30.0440.01033.00
7.1.20.0330.01833.01
7.1.10.0260.01014.90
7.1.00.0250.01214.99
7.0.200.0220.01314.85
7.0.190.0250.00915.08
7.0.180.0210.01014.59
7.0.170.0180.00914.54
7.0.160.0330.01014.54
7.0.150.0880.01314.52
7.0.140.0220.01214.89
7.0.130.0140.01615.15
7.0.120.0190.00614.86
7.0.110.0140.01314.78
7.0.100.0150.01514.63
7.0.90.0130.01314.77
7.0.80.0160.01414.65
7.0.70.0220.01214.41
7.0.60.0130.01314.43
7.0.50.0400.00314.45
7.0.40.0220.01515.10
7.0.30.0170.00715.04
7.0.20.0160.00914.69
7.0.10.0160.00914.73
7.0.00.0210.00314.98

preferences:
34.14 ms | 401 KiB | 5 Q