[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=yeserror=authnumber=025968transactionnumber=313869 As you c, the String contains four parameters.. I explode it first by . $execoutput = approved=yeserror=authnumber=025968transactionnumber=313869;

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=yeserror=authnumber=025968transactionnumber=313869; % $execoutput_array = explode(, $execoutput); I don't see any problem with this. % % I secondly explode every

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=yeserror=authnumber=025968transactionnumber=313869; after the statement for (@reset($value_array);

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=yeserror=authnumber=025968transactionnumber=313869; I definately want to get something

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=yeserror=authnumber=025968transactionnumber=313869; I definately want to get something like

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=yeserror=authnumber=025968transactionnumber=313869; I definately want to get something like

[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

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 there

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. You

[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; $istrlen($string); $i++) $array[$i]=$string[$i]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] string to array

2002-11-08 Thread Timothy Hitchens (HiTCHO)
Kilimajer 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; $istrlen($string); $i++) $array[$i]=$string[$i]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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; $istrlen($string); $i++) $array[$i]=$string[$i]; A string is already an array of chars $string =

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; $istrlen($string); $i++) $array[$i]=$string[$i]; A string is already an array of chars

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 Maxim Maletsky
','t','r','i','n','g'), other then for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net

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( '', 'string' );

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, this

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 ? $string = 'test';

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..

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

[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? I

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 classes that

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 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_ausizeof($priv); $y_au++)

[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]

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:+45

Re: [PHP] string to array??

2002-01-17 Thread Scott Houseman
Scott - Original Message - From: Sandeep Murphy [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 Mailing List

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

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 't'

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: $Globbot =

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 On

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 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

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