You are here: Re: [PHP] Re: Question about "shortening" a string « PHP « IT news, forums, messages
Re: [PHP] Re: Question about "shortening" a string

Posted by Jochem Maas on 03/13/05 00:04

Ashley M. Kirchner wrote:
> Mário Gamito wrote:

....

>> >> Does anyone knows how to do this ?
>> >
>> > <?php
>> > $parts = explode(' ', $fullName);
>> > $shortenedName = $parts[0].' '.$parts[count($parts)-1];
>> > ?>
>> >
>>
> This might solve one problem. What about people who have names like
> 'Pablo Ricardo del Rey' where you can't simply pick first and last
> because their last name really is 'del Rey'. Or 'von Braun', or ...you
> get the idea.
>

I thought so too... I thought maybe you could just provide 3 name text boxes:

<input name="firstname" /><input name="middlenames" /><input name="lastname" />

and store the names seperately, then you could display the short or long
version at will... additionally using substr() and the explode() technique
described above you can also generate their initials to create an even shorter
version of the name.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация