FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » use of substring in php
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: use of substring in php [message #174600 is a reply to message #174594] Tue, 21 June 2011 12:36 Go to previous messageGo to previous message
Allodoxaphobia is currently offline  Allodoxaphobia
Messages: 21
Registered: September 2010
Karma:
Junior Member
On Mon, 20 Jun 2011 20:40:40 -0400, Bill B wrote:
> On 6/20/2011 5:19 PM, Co wrote:
>>
>> I want to cut down the name of the user to 10 characters so it will
>> fit to the picture of the user.
>> At this moment I use $firstnameCut = substr($firstname, 0, 10);
>> However sometimes the name is like:
>>
>> Johannes Paul.
>> with my code it will show: Johannes P
>>
>> How can I change this so if the second or third name doesn't fit
>> within the 10 characters
>> it will not be shown at all?
>
> This is not a PHP answer per se. Give some though to using the first X
> characters from the first name and the first Y characters from the last
> name. It may resolve some of your dilemma.

> It has a favorable side
> effect of producing a decently unique set of characters (most of the time).

And, an 'interesting' side effect of sometimes producing fairly
vulgar character strings...

Jonesy
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Compiling PHP error
Next Topic: free computer ebooks updated daily
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 11:31:59 GMT 2024

Total time taken to generate the page: 0.03789 seconds