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
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
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
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
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
"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.
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
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
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
>> $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?
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,
"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 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
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,
> >
>
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
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
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',
> 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
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
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
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
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
$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
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
-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
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
Hi There.
You should use this function:
split -- split string into array by regular expression
array split (string pattern, string string [, int limit])
So, to split a string ( e.g. a sentence ) so that each word in the string is
an element of the array do something like this
This will ret
-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:
28 matches
Mail list logo