Re: splitting value of string

From: Date: Tue, 08 Aug 2000 04:03:48 +0000
Subject: Re: splitting value of string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10580@lists.php.net to get a copy of this message
On Mon, 7 Aug 2000, Mike Tuller wrote: > Hi, > I currently have an email form that asks for the full name of the person > submitting the email, and on the page that I have set to come up after > submission, I would like to make more personal. > > Example: Thank you, $name for your email. I will get back to you as soon as > possible. > > I would like to extract the first name from the full name field. How is this > done? Could someone point me to an example? Assuming you're expecting a fullname of the format <FirstName> <LastName> (That is, a first name, a space, and a last name), then you could $arr = explode(' ',$fullname); and $arr[0] would be the first name. This is, however, hardly foolproof. Matt

« previous php.general (#10580) next »