<?php

foreach ($strings as $key => $string) {
   $strings[$key] = '<em>' . $string[0] . '</em>' . substr($string, 1);
}

?>

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!
Cheers,
Micky


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

Reply via email to