Re: Convert a string to an array

From: Date: Wed, 23 Oct 2002 16:42:43 +0000
Subject: Re: Convert a string to an array
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-121128@lists.php.net to get a copy of this message
You need to initialize the array outside of the loop and use the appropriate index ($count) Mike "Scott Fletcher" <scott@abcoa.com> wrote in message news:20021023163006.27828.qmail@pb1.pair.com... > I never see this one to work for the array, "$word{$z};" with a " { " or " } > " instead of the bracket. > > "Rick Emery" <remery@emeryloftus.com> wrote in message > news:027b01c27aa7$8f9774b0$0500a8c0@honeybee... > > where is $z set??? > > > > ----- Original Message ----- > > From: "WANDA HANSEN" <scriptsjoint@earthlink.net> > > To: <> > > Sent: Wednesday, October 23, 2002 9:38 AM > > Subject: [PHP] Convert a string to an array > > > > > > Hello, > > > > I am having trouble converting a string to an array. > > > > I have been trying the following: > > $len = strlen($word); > > for($count=0;$count<$len;$count++) > > { > > $w[$z] = $word{$z}; > > } > > > > It appears to create an array, but when I try and shuffle it > > > > $w=shuffle($w); > > > > I get the following error: > > > > Warning: Cannot use a scalar value as an array in > > /home/taylor94/public_html/jumble/stringshuffle.php on line 68 > > > > Any help would be appreciated. > > > > Thanks, > > Wanda > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > >

« previous php.general (#121128) next »