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 something like
> $value_array['approved'] is "yes"
> $value_array['error'] is ""
> $value_array['authnumber'] is "025968"
> $value_array['transactionnumber'] is "313869"

If I'm wrong, blame this on coming into the thread at this stage, not the
beginning.

That string look suspiciously like a GET request.

$myvars = array('approved', 'error', 'authnumber', 'transactionnumber');
foreach ($myvars as $key) {
 $value_array[$key] = $_GET[$key];
}

If it's just a string, something like:
$data_array = split('&', $string);
foreach ($data_array as $key) {
 list($mykey, $value) = split('=', $key);
 $value_array[$mykey] = $value;
}

More than one way to skin a cat, and my foreach loops are probably wrong. 
Simple application of the manual really, in the end.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to