Re: [PHP] String to Array or Hash Table

2003-10-19 Thread Duncan Hill
sun zheng said: >>tx for the reply.. ya, it is what i am looking for.. however, your solution >>is not the right one.. please help me to adjust it a lot.. >> >>let us come back to the initial string .. >>"approved=yes&error=&authnumber=025968&transactionnumber=313869"; > >>I definately want to get

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread sun zheng
tx for the reply.. ya, it is what i am looking for.. however, your solution is not the right one.. please help me to adjust it a lot.. let us come back to the initial string .. "approved=yes&error=&authnumber=025968&transactionnumber=313869"; I definately want to get something like $value_array['a

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread Duncan
sun zheng said: > tx for the reply.. ya, it is what i am looking for.. however, your solution > is not the right one.. please help me to adjust it a lot.. > > let us come back to the initial string .. > "approved=yes&error=&authnumber=025968&transactionnumber=313869"; > I definately want to get so

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread sun zheng
tx for the reply.. ya, it is what i am looking for.. however, your solution is not the right one.. please help me to adjust it a lot.. let us come back to the initial string .. "approved=yes&error=&authnumber=025968&transactionnumber=313869"; after the statement "for (@reset($value_array); lis

Re: [PHP] String to Array or Hash Table

2003-10-19 Thread David T-G
Zheng -- ...and then sun zheng said... % % Hi, all, Hi! % ... % I explode it first by "&". % $execoutput = % "approved=yes&error=&authnumber=025968&transactionnumber=313869"; % $execoutput_array = explode("&", $execoutput); I don't see any problem with this. % % I secondly explode ever

[PHP] String to Array or Hash Table

2003-10-19 Thread sun zheng
Hi, all, The question is concerning a feedback String from a web-service. "approved=yes&error=&authnumber=025968&transactionnumber=313869" As you c, the String contains four parameters.. I explode it first by "&". $execoutput = "approved=yes&error=&authnumber=025968&transactionnumber=313869"

Re: [PHP] string to array

2003-02-12 Thread Steve Werby
"Kevin Waterson" <[EMAIL PROTECTED]> wrote: > What is the best method to convert a string to an array > > I need to able to loop through each letter of the string > not just use $string[47] You can find out how long it is using strlen(), then loop through it using your favorite looping construct.

Re: [PHP] string to array

2003-02-12 Thread Leif K-Brooks
There's no built-in function, but try this (copied from manual): $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); Kevin Waterson wrote: >What is the best method to convert a string to an array > >I need to able to loop through each letter of the string >not just use $string[47] > >Is t

[PHP] string to array

2003-02-12 Thread Kevin Waterson
What is the best method to convert a string to an array I need to able to loop through each letter of the string not just use $string[47] Is there a definitive method to do this? Kevin -- __ (_ \ _) )

Re: [PHP] string to array

2002-11-08 Thread Maxim Maletsky
Guys, not to confuse you, but I think there is a more elegant way doing it that. I had the same issue once long ago (2-3 years ago?) and had put it up on the mailing lists too. Gotta remember what it was and for what project then find the code in my libraries. I really think i accomplished it with

Re: [PHP] string to array

2002-11-08 Thread Marek Kilimajer
This is working great, thank you. Timothy's expression output one empty element at the start and the end, but otherwise worked ( and I don't know why :-( Erwin wrote: $string = explode( '', 'string' ); Timothy Hitchens wrote: That won't work.. empty delimiter errors always.. You

Re: [PHP] string to array

2002-11-08 Thread Erwin
>> $string = explode( '', 'string' ); Timothy Hitchens wrote: > That won't work.. empty delimiter errors always.. Your right, I didn't know. > you will have to use > my preg one from earlier... But your preg thingy will only split at spaces, so that'll have to change to in this case, right?

Re: [PHP] string to array

2002-11-08 Thread @ Edwin
Hello, "Maxim Maletsky" <[EMAIL PROTECTED]> wrote: [snip] > As of actually converting it you could do that very loop and have an: > $atr_arr[] = $str[$i] in it, or, even more elegantly by using split() > function or "...chunk.." something function(), don't remember right now. [/snip] Perhaps,

Re: [PHP] string to array

2002-11-08 Thread Maxim Maletsky
"Erwin" <[EMAIL PROTECTED]> wrote... : > > A string is already an array of chars > > > > $string = 'string'; > > echo $string[0]; // will echo 's' > > True, but that's different than the array type. Sometimes you'll just need > an array instead of a string. > > Try using > > $string = explode(

Re: [PHP] string to array

2002-11-08 Thread Maxim Maletsky
String IS an array. Basically, you could do this: $str = 'The Dummy String'; for($i=0; $i wrote... : > Hi all, > > has anyone an elegant (and faster) way of converting 'string' to > array('s','t','r','i','n','g'), other then > for($i=0; $i > > -- > PHP General Mailing List (http://www.php

Re: [PHP] string to array

2002-11-08 Thread Timothy Hitchens (HiTCHO)
That won't work.. empty delimiter errors always.. you will have to use my preg one from earlier... Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] If you need PHP hosting with an experienced support team 24/7 then email me today. On Fri, 8 Nov 2002, Erwin wrote: > Tom Rogers wrote: > > Hi, > > >

Re: [PHP] string to array

2002-11-08 Thread Erwin
Tom Rogers wrote: > Hi, > > Friday, November 8, 2002, 10:43:10 PM, you wrote: >> Hi all, > >> has anyone an elegant (and faster) way of converting 'string' to >> array('s','t','r','i','n','g'), other then >> for($i=0; $i > > > A string is already an array of chars > > $string = 'string'; > echo $st

Re: [PHP] string to array

2002-11-08 Thread Tom Rogers
Hi, Friday, November 8, 2002, 10:43:10 PM, you wrote: MK> Hi all, MK> has anyone an elegant (and faster) way of converting 'string' to MK> array('s','t','r','i','n','g'), other then MK> for($i=0; $ihttp://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] string to array

2002-11-08 Thread Timothy Hitchens (HiTCHO)
Quick and Dirty: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] If you need PHP hosting with an experienced support team 24/7 then email me today. On Fri, 8 Nov 2002, Marek Kilimajer wrote: > Hi all, > > has anyone an elegant (and faster) way of converting 'string' to > array('s','t','r','i',

[PHP] string to array

2002-11-08 Thread Marek Kilimajer
Hi all, has anyone an elegant (and faster) way of converting 'string' to array('s','t','r','i','n','g'), other then for($i=0; $i -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] string to array?

2002-06-13 Thread David Freeman
> I have a string something like "10.2.3" > I want to be able to use the "." as a delimiter to reference > the elements (10, 2, and 3). > My thought was to create an array, using "." as the > delimiter. Is there a function that will create an array out > of a string, using a delimiter y

Re: [PHP] string to array?

2002-06-13 Thread Analysis & Solutions
On Thu, Jun 13, 2002 at 11:17:50AM -0600, Leston Drake wrote: > > I have a string something like "10.2.3" > I want to be able to use the "." as a delimiter to reference the elements > (10, 2, and 3). http://www.php.net/manual/en/function.explode.php Enjoy, --Dan -- PHP classe

[PHP] string to array?

2002-06-13 Thread Leston Drake
Hi all, I have a string something like "10.2.3" I want to be able to use the "." as a delimiter to reference the elements (10, 2, and 3). My thought was to create an array, using "." as the delimiter. Is there a function that will create an array out of a string, using a delimiter you specify?

[PHP] String to array ???

2002-01-18 Thread Sandeep Murphy
Hi, I have a for loop in which a variable $privid reads and stores the content from a xmlfile in the form of a string.. the string has 5 different values... I want to call this variable $privid outside the loop like this... for($y_au=0; $y_auprivid = $childNodes[$y]->content ;

Re: [PHP] string to array??

2002-01-17 Thread Erik Price
Yes thank you, I thought I would have heard about it before now if all brackets were deprecated! ;) I bit, though, when I read that page you linked to. Thanks for the clarification though. Erik On Thursday, January 17, 2002, at 03:49 PM, Steve Edberg wrote: > Sorry if I was less than to

Re: [PHP] string to array??

2002-01-17 Thread Steve Edberg
Sorry if I was less than totally clear; I was referring to this part of the page: Characters within strings may be accessed by specifying the zero-based offset of the desired character after the string in curly braces. Note: For backwards compatibility, you ca

Re: [PHP] string to array??

2002-01-17 Thread Erik Price
I didn't know that either. Does this apply only when accessing strings by character? Or are all conventional uses of brackets deprecated for the purposes of arrays? It doesn't say on that page (http://www.php.net/manual/en/language.types.string.php , a bit more than halfway down). Erik

Re: [PHP] string to array??

2002-01-17 Thread Erik Price
$TF_string = "Starscream, Megatron, Jetfire, Optimus Prime"; $TF_array = explode(", ", $TF_string); print_r($TF_array); (note the space after the comma in the first argument to "explode()", this necessary to avoid the space being include in each element of the array) Hope that helps, Erik

Re: [PHP] string to array??

2002-01-17 Thread Neil Freeman
You just have to remember that a string is simply a character array :) Nick Wilson wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > * On 17-01-02 at 12:57 > * Steve Edberg said > > > Actually, you can treat a string as an array without any further > > processing: > > > > $G

Re: [PHP] string to array??

2002-01-17 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 17-01-02 at 12:57 * Steve Edberg said > Actually, you can treat a string as an array without any further > processing: > > $Globbot = 'dribcot'; > echo $Globbot[0]; # echoes 'd' > echo $Globbot[6]; # echoes

Re: [PHP] string to array??

2002-01-17 Thread Steve Edberg
Actually, you can treat a string as an array without any further processing: $Globbot = 'dribcot'; echo $Globbot[0]; # echoes 'd' echo $Globbot[6]; # echoes 't' Check out 'String access by character' about halfway down the page at http://www.php.net/m

Re: [PHP] string to array??

2002-01-17 Thread Scott Houseman
hy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 12:41 PM Subject: [PHP] string to array?? > hi, > > can i convert a string to an array?? if so how shud the syntax read?? > > Thnx, > > sands > > -- > PHP General Ma

Re: [PHP] string to array??

2002-01-17 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 17-01-02 at 11:46 * Sandeep Murphy said > hi, > > can i convert a string to an array?? if so how shud the syntax read?? > > Thnx, > > sands > Check out explode() www.php.net/manual/en/function.explode.php - -- Nick Wilson Tel:

[PHP] string to array??

2002-01-17 Thread Sandeep Murphy
hi, can i convert a string to an array?? if so how shud the syntax read?? Thnx, sands -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]