Re: Array to string

From: Date: Wed, 29 Nov 2000 17:28:08 +0000
Subject: Re: Array to string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27845@lists.php.net to get a copy of this message
Hi, Okay, well, now I feel stupid. I didn't even know about explode(). It seems to be working fine. I'm going to go read up on it now. Thanks. Matt McClanahan <cardinal@dodds.net> spoke thusly: > On Wed, 29 Nov 2000, Erik J. Barzeski wrote: > >> Basically, "$fullname" is a string. $fullname[$char] works fine, the >> loop stops when the end of the first name is encountered, and in the case of >> Joe Schmoe, "J" and "o" and "e" are the array elements. >> >> Problem is, when I return $first at the end and echo it... It literally >> becomes the string "Array." The same happens if I do: >> >> $first .= ""; >> >> The variable $first is of type "string" with the value "Array". >> >> I want $first to be a string. In the case of Joe Schmoe, it should be >> the string "Joe". > > I've only been awake for a couple hours so I may not be following what you > want to do.. But if you have a string $name = "Joe Schmoe" that you want > to be an array of the words in the string, why not just use > > $arr = explode(' ',$name); ? > > Matt > > -- Best wishes, Erik J. Barzeski Rules? We don't have rules. We're trying to accomplish something! ************************************************ Email: erik@barzeski.com Web: http://www.barzeski.com/ http://www.soundsetcentral.com/ http://www.applescriptcentral.com/ AIM: iacas ICQ: 8186546 ************************************************

« previous php.general (#27845) next »