I am using Martin Maly's Paypal Library and everything works properly.The thing I could not manage to do is I get something like this in the returning page;
Array
(
[TOKEN] => EC-49D73912N5410881H
[TIMESTAMP] => 2011-11-24T10:59:46Z
[CORRELATIONID] => 328dc8f80aac
[ACK] => Success
[VERSION] => 52.0
[BUILD] => 2271164
[EMAIL] => hello_1321870042_per@blablabla.com
[PAYERID] => QZNN94QVUSL88
[PAYERSTATUS] => verified
[FIRSTNAME] => Test
[LASTNAME] => User
[COUNTRYCODE] => FR
[CUSTOM] => 20|EUR|
)
And I want all these data to be printed seperately such as;
echo $array['EMAIL'];
This is the first time I work with arrays and I have no idea how to deal with it? I would be very glad if anyone out here help me. Thanks.
You can either do:
print_r($array);
or if you want it more readable:
foreach ($array as $key => $value) {
echo "$key: $value
";
}
or this if you want to output some array values but not others:
$output_these_keys = array('FIRSTNAME', 'LASTNAME', 'CUSTOM');
foreach ($array as $key => $value) {
if (in_array($key, $output_these_keys)) echo "$key: $value
";
}
Do you want to access and print array keys and array values separately? Here you go:
foreach($array as $key => $value) {
echo $key . ": " . $value;
}
Also, if you want to drop the keys and instead have indexed array starting from 0 (that is, being able to access array with indexes), use array_values($array);
which will return indexed array
And don't be afraid of really helpful official documentation.