Suppose you have this string:
hiThere
What is the fastest way to find where the first upper case character is? (T
in this example)
I am worried about performance as some words are quite long.
Easiest would be to use preg_match (if there is only 1 match) or preg_match_all (if you want all the matches) http://php.net/manual/en/function.preg-match.php
preg_match_all('/[A-Z]/', $str, $matches, PREG_OFFSET_CAPTURE);
Not sure if it is the fastest..