Now, if it's just for practice, then you need a little change in you code, since strtoupper('\\2') will give '\\2' (i.e. does nothing) and the letter will remain the same.
I meant, since *strtoupper('\\2')* is evaluated _before_ being included in the string (used as replacement), i.e...
preg_replace('/(^)(.)(.*$)/', strtoupper('\\2') . '\\3', 'yikes!'); is evaluated as preg_replace('/(^)(.)(.*$)/', '\\2\\3', 'yikes!'); since *strtoupper('\\2')* => *'\\2'*, that's why I said it does nothing.
In the code sent, *strtoupper()* is passed as a (literal) string which, combined with the "e" modifier (at the end of the expression), gives the effect you were looking for (i.e. the "replacement string" is evaluated --as code-- before it actually replaces the string found)
-- Atentamente / Sincerely, J. Rafael Salazar MagaƱa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php