Hi everyone
i am trying to access the values in a dynamic array that was obtained from a http post object.
for example, i want to access the £80.00 figure below
i.e the £80.00 figure is contained in a subarray that holds a value=key of amountString
Array
(
[12] => Array
(
[0] => amountString
[1] => £80.00
)
[13] => Array
(
[0] => name
[1] => testname
)
}
this is how i generated this array. i got it from a http object i.e:
POST /fail?installation=XXXXXX&msgType=authResult HTTP/1.0
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Host:
Content-Length: 973
User-Agent: WJHRO/1.0 ( HTTP Request Object)
region=new+format+region&authAmountString=%26%23163%3B10.00&_SP.charEnc=UTF8&desc=&tel=&address1=new+format+address1)
i then did the following to get the array:
$data = explode('&', $post);
foreach($data as &$entry) {
$entry = explode('=', $entry);
$entry[1] = urldecode($entry[1]);
}
unset($entry);
i know that i can access an array like this:
$data[12][1]
the problem is that the number change. so, it would not be accurate to use this number system.
is there a better way to do it.
i suspect that the problem is in my forloop. the forloop renders the array into numbers rather than as key-value array.