Re: Emphasizing first letter of string?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Micky Hulse wrote:
> Hi,
> 
> It is getting late, and I do not think I am thinking clearly...
> 
> What would be the best way to wrap <em></em> tag around the first letter
> of a string?
> 
> I know it has to be a combination of str_replace() and substr(), but due
> to my level of sleepiness I am having a lot of trouble working this one
> out...
> 
> Basically, if a config variable == true I want my script to loop through
> an array of strings and emphasize the first letter of each string.
> 
> Make sense? Sorry, I am pretty sleepy... Hmmm, I am betting I will
> discover the answer as soon as I send this email. :D
> 
> Anyway, any help would be great!

It sounds like you really need some sleep.

$string = "hello world";
echo "<em>".$string{0}."</em>".substr($string, 1);


David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux