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;
Output for git.master, git.master_jit, rfc.property-hooks
Letter to find: P Word to find: PHP Position of letter: 80

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.56 ms | 401 KiB | 8 Q