|
Posted by Ashley M. Kirchner on 10/04/88 11:10
Mário Gamito wrote:
> Hi Sokolewicz,
>
> Thanks a lot.
> It just working really fine :)
>
> M. Sokolewicz wrote:
>
> > Mário Gamito wrote:
> >
> >> 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,...
> >>
> >> 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.
--
H | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Imaging . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
[Back to original message]
|