Someone, please help me to get only the order id from this array:
array(2) {
["success"] => int(1)
["return"] => array(1) {
[100010973975966] => array(7) {
["pair"] => string(8) "doge_btc"
["type"]=> string(3) "buy"
["start_amount"]=> int(300)
["amount"]=> int(300)
["rate"]=> float(3.9E-7)
["timestamp_created"]=> string(10) "1530443432"
["status"]=> int(0)
}
}
}
I need to extract only 100010973975966 as a variable. I am using this code to get this data from yobit:
$order_info = $yobit->privatePostOrderInfo(
array(
"nonce" => time(),
"order_id" => $result["return"]["order_id"]
)
);
Thanks a lot!
You mean 100010973975966
? You could get that with array_keys( $result["return"] )[0]
.
Looking at the image in the comments, $order_info
is the variable that contains the array with the data.
To get the order id which is the key from the array $order_info['return']
you might use key:
$order_info = [
"success" => 1,
"return" => [
"100010973975966" => [
"pair" => "doge_btc"
// etc..
]
]
];
$order_id = key($order_info['return']);
echo $order_id; // 100010973975966