Reply to Re: [PHP] Re: Question about "shortening" a string

Your name:

Reply:


Posted by Mαrio Gamito on 10/06/44 11:10

Hi Sokolewicz,

Thanks a lot.
It just working really fine :)

Thank you again.

Warm regards,
MΓ‘rio Gamito

M. Sokolewicz wrote:

> MΓ‘rio Gamito wrote:
>
>> Hi,
>>
>> In Portgal we have big names.
>> My complete name, for instance, is "MΓ‘rio Augusto Machado dos Reis
Gamito".
>> "MΓ‘rio" is the Christian name and "Gamito" - the last one - is
always the last name of the father.
>>
>> I have a form where i want to let my users insert their full big
name like mine, but i want to shorten them just to the first and the last.
>>
>> For example, if i fill the form with "MΓ‘rio Augusto Machado dos Reis
Gamito", i want to change this string to only "MΓ‘rio Gamito".
>>
>> The total number of names is not fix.
>> Could be 3, 4, 5, 6,...
>> My son name is "Manuel Ramos Gamito". Only 3 names.
>> Should be changed to "Manuel Gamito", also.
>>
>> I've looked at the strings functions in the manual, made a lot of
experiences, but couldn't get there :(
>>
>> Does anyone knows how to do this ?
>>
>> Any help would be apreciated.
>>
>> Warm Regards,
>> MΓ‘rio Gamito
>
>
> <?php
> $parts = explode(' ', $fullName);
> $shortenedName = $parts[0].' '.$parts[count($parts)-1];
> ?>
>

[Back to original 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация