I am trying to process an array to get variable name and its value. below is the code.
$s = explode("&",$mine);
foreach($s as $k=>$v){
$v=explode("=",$v);
for($i=0;$i<count($v);$i++){
$a[$v[$i]]=$v[$i+1];
}
print_r($a);
}
The prolem is that the array repeats itself in output. as shown(look at it keenly):
Array ( [APIresult] => 000;APIresultexplnation [000;APIresultexplnation] => Transaction Created;TransactionToken [Transaction Created;TransactionToken] => 79A9DC2A-622B-4334-B610-001F4976C6C0 [79A9DC2A-622B-4334-B610-001F4976C6C0] => )
I want it give variable and value e.g [APIresult] => 000;TransactionToken => 79A9DC2A-622B-4334-B610-001F4976C6C0. The response i.e original string is this:
APIresult=000;APIresultexplnation=Transaction Created;TransactionToken=D2AB45E4-1DE7-4828-96CA-3A884697109A
This is a response from a third party API. How can i get round this because i want to get the result for each variable for easy processing.