Re: [PHP] preg_replace \\1 yIKES!
On Jun 13, 2006, at 1:58 PM, tedd wrote: At 11:33 AM -0700 6/13/06, sam wrote: Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. Try: ?php $word = yikes; $word[0]=strtoupper($word[0]); echo($word); ? This blows my mind. What should one think, everything is an array? Well, okay not every but everything that's in linear consecutive order; anything that can be indexed? I was trying to make an array from $word but explode() doesn't take an empty delimiter so I gave up and went for the preg_replace. And hey yo, Jochem, I did RTFM, for hours, I always do before I post to the list. I just missed all the answers in the fine manual this time. Cut me some slack. Where should I wire the Euros to? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
sam wrote: On Jun 13, 2006, at 1:58 PM, tedd wrote: At 11:33 AM -0700 6/13/06, sam wrote: Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. Try: ?php $word = yikes; $word[0]=strtoupper($word[0]); echo($word); ? This blows my mind. What should one think, everything is an array? an array is an array. a string is a string. characters in a string can be accessed using array-like notation using the offset postion of the relevant char (elements are zero based) Well, okay not every but everything that's in linear consecutive order; anything that can be indexed? I was trying to make an array from $word but explode() doesn't take an empty delimiter so I gave up and went for the preg_replace. And hey yo, Jochem, I did RTFM, for hours, I always do before I post to the list. I just I'd tell you to RTFM (although I did tell you to read the manual regarding the specifics of using preg_replace()'s 'e' modifier after showing you a working example of how to use it, based on your original code snippet) I did berate the fact that you waited no more than 7 minutes before sending a 'help me' reminder regarding your original post. missed all the answers in the fine manual this time. Cut me some slack. cut you slack? are you a graphic designer or something? Where should I wire the Euros to? my paypal account name is my email address :-) --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
Jochem Maas wrote: I did berate the fact that you waited no more than 7 minutes before sending a 'help me' reminder regarding your original post. While I agree with most of what you are saying, you may want to check that email again. Sams 'for Eyes burning...' email was in response to someone privately suggesing that he use ucfirst. It was *not* a 'help me' reminder, so drop that criticism please. Aside from that, anyone who manages to miss ucfirst when R'ingTFM for this problem should RTFM some more. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
And hey yo, Jochem, I did RTFM, for hours, I always do before I post to the list. I just I'd tell you to RTFM (although I did tell you to read the manual regarding the specifics of using preg_replace()'s 'e' modifier after showing you a working example of how to use it, based on your original code snippet) Yes, I'm using your example right now to help me learn this preg_replace beast. The php.net page on preg_replace was just to overwhelming for the exhausted state of mind I was in. I did berate the fact that you waited no more than 7 minutes before sending a 'help me' reminder regarding your original post. No, that was a misunderstanding, I was just saying thanks to the guy who said, why not just use ulfirst(). (Which I also missed on the php.net page on strings.) missed all the answers in the fine manual this time. Cut me some slack. cut you slack? are you a graphic designer or something? How did you know? I was 'in' graphics for 30 years before I threw my hands up at that lunatic world and decided to become a programmer. I love the printing industry but ever since the Mac took over everybody went nuts. The printers are still mad, after 15 years, that the Mac took away their razor blades and rubylith. Checks in the mail. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
Stut wrote: Jochem Maas wrote: I did berate the fact that you waited no more than 7 minutes before sending a 'help me' reminder regarding your original post. While I agree with most of what you are saying, you may want to check that email again. Sams 'for Eyes burning...' email was in response to someone privately suggesing that he use ucfirst. It was *not* a 'help me' reminder, so drop that criticism please. consider it dropped - I didn't catch that it was a reply to an offlist post. Aside from that, anyone who manages to miss ucfirst when R'ingTFM for this problem should RTFM some more. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
At 3:45 AM -0700 6/14/06, sam wrote: On Jun 13, 2006, at 1:58 PM, tedd wrote: At 11:33 AM -0700 6/13/06, sam wrote: Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. Try: ?php $word = yikes; $word[0]=strtoupper($word[0]); echo($word); ? This blows my mind. What should one think, everything is an array? Well, okay not every but everything that's in linear consecutive order; anything that can be indexed? I was trying to make an array from $word but explode() doesn't take an empty delimiter so I gave up and went for the preg_replace. Sorry, it was a throwback to my C days -- using ucfist() is better. tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
for Eyes burning; caffein shakes; project overdue Thanks Why not just use ucfirst http://us2.php.net/manual/en/ function.ucfirst.php? -Original Message- From: sam [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 13, 2006 2:34 PM To: PHP Subject: [PHP] preg_replace \\1 yIKES! 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
sam wrote: 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! to running strtoupper() on the string literal '\\2' which after it has been capitalized will be '\\2'. if you *really* want to use preg_replace(): echo preg_replace(/(^)(.)(.*\$)/e, \\\1\ . strtoupper(\\\2\) . \\\3\, yikes!), \n; notice the 'e' modifier on the regexp - it causes the replace string to be treated as a string of php code that is autoamtically evaluated - checvk the manual for more info. (I used double quotes only so that I could test the code on the cmdline using 'php -r') ...BUT I suggest you try this function instead: ucfirst() Thanks --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
sam wrote: for Eyes burning; caffein shakes; project overdue nobody here cares whether your project is overdue - waiting 7 minutes before sending a 'reminder' about the question you asked suggests you need to take a PATIENCE lesson. or did some fraudster sell you a php support contract? ... for 500 euros you can contact me anytime at [EMAIL PROTECTED] for all you php woes :-P Thanks Why not just use ucfirst http://us2.php.net/manual/en/function.ucfirst.php? -Original Message- From: sam [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 13, 2006 2:34 PM To: PHP Subject: [PHP] preg_replace \\1 yIKES! 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 --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
On Tue, 2006-06-13 at 15:07, Jochem Maas wrote: sam wrote: for Eyes burning; caffein shakes; project overdue nobody here cares whether your project is overdue - waiting 7 minutes before sending a 'reminder' about the question you asked suggests you need to take a PATIENCE lesson. or did some fraudster sell you a php support contract? ... for 500 euros you can contact me anytime at [EMAIL PROTECTED] for all you php woes :-P Oooh, GREAT IDEA!! *scribbles down into his notebook* :B Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
At 11:33 AM -0700 6/13/06, sam wrote: Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. Try: ?php $word = yikes; $word[0]=strtoupper($word[0]); echo($word); ? tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
On 13/06/06, tedd [EMAIL PROTECTED] wrote: At 11:33 AM -0700 6/13/06, sam wrote: Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. Why not use ucfirst(), that is what the function is for. -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk