preg_replace \\1 yIKES!
| From: | sam | Date: | Tue, 13 Jun 2006 18:33:33 +0000 |
| Subject: | preg_replace \\1 yIKES! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237913@lists.php.net to get a copy of this message | ||
Wow this is hard I can't wait till I get the hang of it.
Capitalize the first letter of a word.
echo preg_replace('/(^)(.)(.*$)/', strtoupper('\\2') . '\\3', 'yikes!');
// outputs yikes!
Nope didn't work.
So I want to see if I'm in the right place:
echo preg_replace('/(^)(.)(.*$)/', '\\1' . '-' . strtoupper('\\2') . '-' . '\\3', 'yikes!');
//outputs -y-ikes!
So yea I've got it surrounded why now strtoupper: Yikes!
Thanks