Re: Probably a stupid Array question

From: Date: Sun, 31 Mar 2002 05:44:34 +0000
Subject: Re: Probably a stupid Array question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18072@lists.php.net to get a copy of this message
On Sunday 31 March 2002 13:07, Chris Payne wrote: > Hi there everyone, > > I do this to explode my input line which consists of however many words: > > $words = explode(" ", $testb); > > Now i've done this and I presume that $words holds all the info as an Array > (new to arrays, sorry if i'm wrong) however, how can I put each item of the > array from $words into a different string? IE: if there are 3 items, how > could I have it so that the first word is stored in $word1, the second > words is stored in $word2 etc??? Please help, thank you all so much :-) Not sure why you want to do that. The whole point of using arrays is to simplify the handling of multiple 'related' variables. In the above example you would simply refer to the first word as $words[0], the second as $words[1] etc. If you really want to do $word1, $word2 ..., then read about: Variable Variables foreach -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Give me chastity and continence, but not just now. -- St. Augustine */

« previous php.db (#18072) next »