On Sun, 2007-01-21 at 16:49 +0100, Jochem Maas wrote:
> now we can get on with having a flame war as to the 'best' way to style
> your code, because obviously this is better ;-) ...
Game on! :B
> echo trim(substr((string)$forename, 0, 1).' '.$surname);
Surely any fool can see that yours is infer
Robert Cummings wrote:
> On Sun, 2007-01-21 at 16:27 +0100, Jochem Maas wrote:
>> Robert Cummings wrote:
>>> On Sun, 2007-01-21 at 16:02 +0100, Jochem Maas wrote:
>>>
$initial = (is_string($forename) && strlen($forename) > 0)
? $forename[0]
: ''
;
echo
On Sun, 2007-01-21 at 16:27 +0100, Jochem Maas wrote:
> Robert Cummings wrote:
> > On Sun, 2007-01-21 at 16:02 +0100, Jochem Maas wrote:
> >> >>
> >> $initial = (is_string($forename) && strlen($forename) > 0)
> >> ? $forename[0]
> >> : ''
> >> ;
> >>
> >> echo trim($initial.' '.$surnam
Robert Cummings wrote:
> On Sun, 2007-01-21 at 16:02 +0100, Jochem Maas wrote:
>> >
>> $initial = (is_string($forename) && strlen($forename) > 0)
>> ? $forename[0]
>> : ''
>> ;
>>
>> echo trim($initial.' '.$surname);
>>
>> ?>
>
> That sure is verbose Jochem...
agreed, it was don
On Sun, 2007-01-21 at 16:02 +0100, Jochem Maas wrote:
>
>
> $initial = (is_string($forename) && strlen($forename) > 0)
>? $forename[0]
>: ''
>;
>
> echo trim($initial.' '.$surname);
>
> ?>
That sure is verbose Jochem...
Cheers,
Rob.
--
.--
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 ans
Hello Christopher Deeley,
Best regards,
=== At 2007-01-21, 21:49:06 you 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
, January 21, 2007 3:44 PM
To: php-general@lists.php.net
Subject: [PHP] First Character In A String
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 &
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?
Thank You In Advance
9 matches
Mail list logo