Re: Array to string

From: Date: Wed, 29 Nov 2000 17:21:36 +0000
Subject: Re: Array to string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27839@lists.php.net to get a copy of this message
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

« previous php.general (#27839) next »