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)
7.1.70.0300.00615.29
7.1.60.0470.01533.25
7.1.50.0440.01732.78
7.1.40.0470.01532.28
7.1.30.0380.02432.46
7.1.20.0490.01232.70
7.1.10.0220.01014.62
7.1.00.0830.01514.45
7.0.200.0180.01414.66
7.0.190.0290.00914.81
7.0.180.0350.01514.20
7.0.170.0260.01113.95
7.0.160.0270.01014.14
7.0.150.0130.01314.08
7.0.140.0250.00314.26
7.0.130.0320.00314.61
7.0.120.0240.00814.56
7.0.110.0170.01814.32
7.0.100.0160.01914.34
7.0.90.0200.01514.02
7.0.80.0230.01314.19
7.0.70.0250.00514.30
7.0.60.0200.01514.11
7.0.50.0300.01314.50
7.0.40.0270.01314.35
7.0.30.0440.01214.48
7.0.20.0310.00914.13
7.0.10.0270.00614.55
7.0.00.0200.00314.37

preferences:
140.56 ms | 1394 KiB | 7 Q