Re: preg_replace \\1 yIKES!
| From: | Jochem Maas | Date: | Wed, 14 Jun 2006 11:04:30 +0000 |
| Subject: | Re: preg_replace \\1 yIKES! | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237965@lists.php.net to get a copy of this message | ||
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
>