Christopher Deeley wrote:
> Can anyone tell me if there is a function to return the first letter in a
> string, such as:
> 
> $surname="SMITH";
> $forename="ALAN";
> 
> Is there a function which I can use to make $forename "A", so I can display
> it as A SMITH?

another alternative to the other answers you have had,
this alternative introduces you to the 'String access and modification by 
character'
functionality as described here:

        http://nl2.php.net/manual/en/language.types.string.php


<?php

$initial = (is_string($forename) && strlen($forename) > 0)
         ? $forename[0]
         : ''
         ;

echo trim($initial.' '.$surname);

> 
> Thank You In Advance
> 

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

Reply via email to