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;
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
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);
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
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
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
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
--
__
(_ \
_) )
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
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
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
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
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 =
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
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,
','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
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' );
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
$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';
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..
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
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
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
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?
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++)
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]
-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
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
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
-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'
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 =
$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
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
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
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
34 matches
Mail list logo