I have decoded the JSON but i am not able to echo the single values. I want to print "ref" from "transaction" array.
array(3) { ["method"]=> string(5) "check" ["trace"]=> string(19) "4000/22390/5f67437b" ["order"]=> array(11) { ["ref"]=> string(64) "E35B2D1E4F7A28B9F7D397B22FFB84B75EFB3DB091B91540CA0B759924EA378E" ["cartid"]=> string(19) "18460_5f67381dec52e" ["test"]=> int(1) ["amount"]=> string(6) "545.00" ["currency"]=> string(3) "AED" ["description"]=> string(22) "Your order from Baaqah" ["status"]=> array(2) { ["code"]=> int(3) ["text"]=> string(4) "Paid" } ["transaction"]=> array(7) { ["ref"]=> string(12) "030025829659" ["date"]=> string(21) "20 Sep 2020 15:08 GST" ["type"]=> string(4) "sale" ["class"]=> string(4) "ECom" ["status"]=> string(1) "A" ["code"]=> string(6) "909959" ["message"]=> string(10) "Authorised" }
I used the below commands but i cannot print the last one. It's coming out empty.
var_dump($response);
echo "METHOD: ". $response["method"]; // Access Array data
echo "TRACE: ". $response["trace"]; // Access Array data
echo "REF: ". $response["transaction"]["ref"]; // Access Array data
Thanks in advance.
If you format your dump, you will see that its in: $response["order"]["transaction"]["ref"]
array(3) {
["method"]=> string(5) "check"
["trace"]=> string(19) "4000/22390/5f67437b"
["order"]=> array(11) {
["ref"]=> string(64) "E35B2D1E4F7A28B9F7D397B22FFB84B75EFB3DB091B91540CA0B759924EA378E"
["cartid"]=> string(19) "18460_5f67381dec52e"
["test"]=> int(1)
["amount"]=> string(6) "545.00"
["currency"]=> string(3) "AED"
["description"]=> string(22) "Your order from Baaqah"
["status"]=> array(2) {
["code"]=> int(3)
["text"]=> string(4) "Paid"
}
["transaction"]=> array(7) {
["ref"]=> string(12) "030025829659"
["date"]=> string(21) "20 Sep 2020 15:08 GST"
["type"]=> string(4) "sale"
["class"]=> string(4) "ECom"
["status"]=> string(1) "A"
["code"]=> string(6) "909959"
["message"]=> string(10) "Authorised"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.